vim:syn:md: Use lookarounds instead of \zs & \ze

Apparently the `\zs` token does not match characters if they are already
part of a syntax match. For example in `[^0][^1]` only the zero footnote
is matched. Fix this by using a positive lookbehind that does not have
this limitation.

Additionally, use a negative lookahead for the colon to make the pattern
slightly more readable, since it does not need the end-of-line check.
This commit is contained in:
2025-08-12 12:58:14 +02:00
parent 3fb5b5f376
commit 372865f9c4

View File

@@ -1,11 +1,11 @@
" Either not at the start of the line, or otherwise not followed by a colon
syntax match markdownFootnoteZero /\v(.\zs\[\^0\])|(^\[\^0\]\ze([^:]|$))/ conceal cchar=
syntax match markdownFootnoteOne /\v(.\zs\[\^1\])|(^\[\^1\]\ze([^:]|$))/ conceal cchar=¹
syntax match markdownFootnoteTwo /\v(.\zs\[\^2\])|(^\[\^2\]\ze([^:]|$))/ conceal cchar=²
syntax match markdownFootnoteThree /\v(.\zs\[\^3\])|(^\[\^3\]\ze([^:]|$))/ conceal cchar=³
syntax match markdownFootnoteFour /\v(.\zs\[\^4\])|(^\[\^4\]\ze([^:]|$))/ conceal cchar=
syntax match markdownFootnoteFive /\v(.\zs\[\^5\])|(^\[\^5\]\ze([^:]|$))/ conceal cchar=
syntax match markdownFootnoteSix /\v(.\zs\[\^6\])|(^\[\^6\]\ze([^:]|$))/ conceal cchar=
syntax match markdownFootnoteSeven /\v(.\zs\[\^7\])|(^\[\^7\]\ze([^:]|$))/ conceal cchar=
syntax match markdownFootnoteEight /\v(.\zs\[\^8\])|(^\[\^8\]\ze([^:]|$))/ conceal cchar=
syntax match markdownFootnoteNine /\v(.\zs\[\^9\])|(^\[\^9\]\ze([^:]|$))/ conceal cchar=
syntax match markdownFootnoteZero /\v(.@1<=\[\^0\])|(^\[\^0\]:@!)/ conceal cchar=
syntax match markdownFootnoteOne /\v(.@1<=\[\^1\])|(^\[\^1\]:@!)/ conceal cchar=¹
syntax match markdownFootnoteTwo /\v(.@1<=\[\^2\])|(^\[\^2\]:@!)/ conceal cchar=²
syntax match markdownFootnoteThree /\v(.@1<=\[\^3\])|(^\[\^3\]:@!)/ conceal cchar=³
syntax match markdownFootnoteFour /\v(.@1<=\[\^4\])|(^\[\^4\]:@!)/ conceal cchar=
syntax match markdownFootnoteFive /\v(.@1<=\[\^5\])|(^\[\^5\]:@!)/ conceal cchar=
syntax match markdownFootnoteSix /\v(.@1<=\[\^6\])|(^\[\^6\]:@!)/ conceal cchar=
syntax match markdownFootnoteSeven /\v(.@1<=\[\^7\])|(^\[\^7\]:@!)/ conceal cchar=
syntax match markdownFootnoteEight /\v(.@1<=\[\^8\])|(^\[\^8\]:@!)/ conceal cchar=
syntax match markdownFootnoteNine /\v(.@1<=\[\^9\])|(^\[\^9\]:@!)/ conceal cchar=