feat(vim): conceal markup delimiters when conceallevel=2

Set conceallevel=2 and concealcursor=nc on .wiki buffers and add
contained `conceal` matches for the bold/italic/code delimiters and
wikilink brackets/targets. The static-fallback rendering now mirrors
what the Neovim semantic-token path produced: *bold* shows as bold
without the asterisks, [[target|desc]] shows just "desc", etc.

The wikilink region uses an inline `contains=` (no line continuation)
because some Vim builds (notably Homebrew Vim 9.2) raise E10 on the
leading `\\ contains=...` form even though the surrounding region
parses fine.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-26 22:01:55 -03:00
parent 2aec51274e
commit 8f8c2884a9
2 changed files with 19 additions and 5 deletions
+16 -4
View File
@@ -68,12 +68,24 @@ syntax region nuwikiPreformatted start=/^{{{/ end=/^}}}/ keepend
syntax region nuwikiMathBlock start=/^{{\$/ end=/^}}\$/ keepend
syntax match nuwikiPlaceholder /^%\(title\|nohtml\|template\|date\)\>.*$/
syntax match nuwikiBold /\*[^*]\+\*/
syntax match nuwikiItalic /\<_[^_]\+_\>/
syntax match nuwikiCode /`[^`]\+`/
syntax match nuwikiBold /\*[^*]\+\*/ contains=nuwikiBoldDelim
syntax match nuwikiBoldDelim /\*/ contained conceal
syntax match nuwikiItalic /\<_[^_]\+_\>/ contains=nuwikiItalicDelim
syntax match nuwikiItalicDelim /_/ contained conceal
syntax match nuwikiCode /`[^`]\+`/ contains=nuwikiCodeDelim
syntax match nuwikiCodeDelim /`/ contained conceal
syntax match nuwikiMathInline /\$[^$]\+\$/
syntax match nuwikiKeyword /\<\(TODO\|DONE\|STARTED\|FIXME\|FIXED\|XXX\)\>/
syntax region nuwikiWikilink start=/\[\[/ end=/\]\]/ keepend
" Wikilink conceal: hide [[ / ]], and for [[target|desc]] hide target|.
syntax region nuwikiWikilink start=/\[\[/ end=/\]\]/ keepend contains=nuwikiWikilinkBracket,nuwikiWikilinkTarget
syntax match nuwikiWikilinkBracket /\[\[/ contained conceal
syntax match nuwikiWikilinkBracket /\]\]/ contained conceal
syntax match nuwikiWikilinkTarget /[^|\]]*|/ contained conceal
syntax region nuwikiTransclusion start=/{{[^{]/ end=/}}/ keepend
syntax match nuwikiUrl /\<\(https\?\|ftp\|mailto\|file\):\/\?\/\?\S\+/