Skip to content

Commit

Permalink
feat(syntax): more strict conceal delimiter matching
Browse files Browse the repository at this point in the history
refer: #3002
  • Loading branch information
lervag committed Sep 23, 2024
1 parent a61db58 commit 2747dec
Showing 1 changed file with 40 additions and 38 deletions.
78 changes: 40 additions & 38 deletions autoload/vimtex/syntax/core.vim
Original file line number Diff line number Diff line change
Expand Up @@ -2005,6 +2005,8 @@ function! s:match_math_delims() abort " {{{1
return
endif

syntax match texMathDelimMod contained conceal "\\[bB]igg\?\>"

syntax match texMathDelim contained conceal cchar=| "\\left|\s*"
syntax match texMathDelim contained conceal cchar=| "\s*\\right|"
syntax match texMathDelim contained conceal cchar= "\\left\\|\s*"
Expand All @@ -2027,47 +2029,47 @@ function! s:match_math_delims() abort " {{{1
syntax match texMathDelim contained conceal cchar= "\s*\\rangle\>"
syntax match texMathDelim contained conceal cchar= "\\lfloor\>\s*"
syntax match texMathDelim contained conceal cchar= "\s*\\rfloor\>"
syntax match texMathDelim contained conceal cchar=< "\\\%([bB]igg\?l\?\|left\)<\s*"
syntax match texMathDelim contained conceal cchar=> "\s*\\\%([bB]igg\?r\?\|right\)>"
syntax match texMathDelim contained conceal cchar=( "\\\%([bB]igg\?l\?\|left\)(\s*"
syntax match texMathDelim contained conceal cchar=) "\s*\\\%([bB]igg\?r\?\|right\))"
syntax match texMathDelim contained conceal cchar=[ "\\\%([bB]igg\?l\?\|left\)\[\s*"
syntax match texMathDelim contained conceal cchar=] "\s*\\\%([bB]igg\?r\?\|right\)]"
syntax match texMathDelim contained conceal cchar={ "\\\%([bB]igg\?l\?\|left\)\\{\s*"
syntax match texMathDelim contained conceal cchar=} "\s*\\\%([bB]igg\?r\?\|right\)\\}"
syntax match texMathDelim contained conceal cchar={ "\\\%([bB]igg\?l\?\|left\)\\lbrace\>\s*"
syntax match texMathDelim contained conceal cchar=} "\s*\\\%([bB]igg\?r\?\|right\)\\rbrace\>"
syntax match texMathDelim contained conceal cchar= "\\\%([bB]igg\?l\?\|left\)\\lceil\>\s*"
syntax match texMathDelim contained conceal cchar= "\s*\\\%([bB]igg\?r\?\|right\)\\rceil\>"
syntax match texMathDelim contained conceal cchar= "\\\%([bB]igg\?l\?\|left\)\\lfloor\>\s*"
syntax match texMathDelim contained conceal cchar= "\s*\\\%([bB]igg\?r\?\|right\)\\rfloor\>"
syntax match texMathDelim contained conceal cchar= "\\\%([bB]igg\?l\?\|left\)\\lgroup\>\s*"
syntax match texMathDelim contained conceal cchar= "\s*\\\%([bB]igg\?r\?\|right\)\\rgroup\>"
syntax match texMathDelim contained conceal cchar= "\\\%([bB]igg\?l\?\|left\)\\lmoustache\>\s*"
syntax match texMathDelim contained conceal cchar= "\s*\\\%([bB]igg\?r\?\|right\)\\rmoustache\>"
syntax match texMathDelim contained conceal cchar=| "\\\%([bB]igg\?l\?\|left\)|\s*"
syntax match texMathDelim contained conceal cchar=| "\s*\\\%([bB]igg\?r\?\|right\)|"
syntax match texMathDelim contained conceal cchar= "\\\%([bB]igg\?l\?\|left\|\)\\|\s*"
syntax match texMathDelim contained conceal cchar= "\s*\\\%([bB]igg\?r\?\|right\)\\|"
syntax match texMathDelim contained conceal cchar= "\\\%([bB]igg\?l\?\|left\)\\downarrow\>\s*"
syntax match texMathDelim contained conceal cchar= "\s*\\\%([bB]igg\?r\?\|right\)\\downarrow\>"
syntax match texMathDelim contained conceal cchar= "\\\%([bB]igg\?l\?\|left\)\\Downarrow\>\s*"
syntax match texMathDelim contained conceal cchar= "\s*\\\%([bB]igg\?r\?\|right\)\\Downarrow\>"
syntax match texMathDelim contained conceal cchar= "\\\%([bB]igg\?l\?\|left\)\\uparrow\>\s*"
syntax match texMathDelim contained conceal cchar= "\s*\\\%([bB]igg\?r\?\|right\)\\uparrow\>"
syntax match texMathDelim contained conceal cchar= "\\\%([bB]igg\?l\?\|left\)\\Uparrow\>\s*"
syntax match texMathDelim contained conceal cchar= "\s*\\\%([bB]igg\?r\?\|right\)\\Uparrow\>"
syntax match texMathDelim contained conceal cchar= "\\\%([bB]igg\?l\?\|left\)\\updownarrow\>\s*"
syntax match texMathDelim contained conceal cchar= "\s*\\\%([bB]igg\?r\?\|right\)\\updownarrow\>"
syntax match texMathDelim contained conceal cchar= "\\\%([bB]igg\?l\?\|left\)\\Updownarrow\>\s*"
syntax match texMathDelim contained conceal cchar= "\s*\\\%([bB]igg\?r\?\|right\)\\Updownarrow\>"
syntax match texMathDelim contained conceal cchar=< "\\\%([bB]igg\?l\|left\)<\s*"
syntax match texMathDelim contained conceal cchar=> "\s*\\\%([bB]igg\?r\|right\)>"
syntax match texMathDelim contained conceal cchar=( "\\\%([bB]igg\?l\|left\)(\s*"
syntax match texMathDelim contained conceal cchar=) "\s*\\\%([bB]igg\?r\|right\))"
syntax match texMathDelim contained conceal cchar=[ "\\\%([bB]igg\?l\|left\)\[\s*"
syntax match texMathDelim contained conceal cchar=] "\s*\\\%([bB]igg\?r\|right\)]"
syntax match texMathDelim contained conceal cchar={ "\\\%([bB]igg\?l\|left\)\\{\s*"
syntax match texMathDelim contained conceal cchar=} "\s*\\\%([bB]igg\?r\|right\)\\}"
syntax match texMathDelim contained conceal cchar={ "\\\%([bB]igg\?l\|left\)\\lbrace\>\s*"
syntax match texMathDelim contained conceal cchar=} "\s*\\\%([bB]igg\?r\|right\)\\rbrace\>"
syntax match texMathDelim contained conceal cchar= "\\\%([bB]igg\?l\|left\)\\lceil\>\s*"
syntax match texMathDelim contained conceal cchar= "\s*\\\%([bB]igg\?r\|right\)\\rceil\>"
syntax match texMathDelim contained conceal cchar= "\\\%([bB]igg\?l\|left\)\\lfloor\>\s*"
syntax match texMathDelim contained conceal cchar= "\s*\\\%([bB]igg\?r\|right\)\\rfloor\>"
syntax match texMathDelim contained conceal cchar= "\\\%([bB]igg\?l\|left\)\\lgroup\>\s*"
syntax match texMathDelim contained conceal cchar= "\s*\\\%([bB]igg\?r\|right\)\\rgroup\>"
syntax match texMathDelim contained conceal cchar= "\\\%([bB]igg\?l\|left\)\\lmoustache\>\s*"
syntax match texMathDelim contained conceal cchar= "\s*\\\%([bB]igg\?r\|right\)\\rmoustache\>"
syntax match texMathDelim contained conceal cchar=| "\\\%([bB]igg\?l\|left\)|\s*"
syntax match texMathDelim contained conceal cchar=| "\s*\\\%([bB]igg\?r\|right\)|"
syntax match texMathDelim contained conceal cchar= "\\\%([bB]igg\?l\|left\)\\|\s*"
syntax match texMathDelim contained conceal cchar= "\s*\\\%([bB]igg\?r\|right\)\\|"
syntax match texMathDelim contained conceal cchar= "\\\%([bB]igg\?l\|left\)\\downarrow\>\s*"
syntax match texMathDelim contained conceal cchar= "\s*\\\%([bB]igg\?r\|right\)\\downarrow\>"
syntax match texMathDelim contained conceal cchar= "\\\%([bB]igg\?l\|left\)\\Downarrow\>\s*"
syntax match texMathDelim contained conceal cchar= "\s*\\\%([bB]igg\?r\|right\)\\Downarrow\>"
syntax match texMathDelim contained conceal cchar= "\\\%([bB]igg\?l\|left\)\\uparrow\>\s*"
syntax match texMathDelim contained conceal cchar= "\s*\\\%([bB]igg\?r\|right\)\\uparrow\>"
syntax match texMathDelim contained conceal cchar= "\\\%([bB]igg\?l\|left\)\\Uparrow\>\s*"
syntax match texMathDelim contained conceal cchar= "\s*\\\%([bB]igg\?r\|right\)\\Uparrow\>"
syntax match texMathDelim contained conceal cchar= "\\\%([bB]igg\?l\|left\)\\updownarrow\>\s*"
syntax match texMathDelim contained conceal cchar= "\s*\\\%([bB]igg\?r\|right\)\\updownarrow\>"
syntax match texMathDelim contained conceal cchar= "\\\%([bB]igg\?l\|left\)\\Updownarrow\>\s*"
syntax match texMathDelim contained conceal cchar= "\s*\\\%([bB]igg\?r\|right\)\\Updownarrow\>"

if &ambiwidth ==# 'double'
syntax match texMathDelim contained conceal cchar= "\\\%([bB]igg\?l\?\|left\)\\langle\>\s*"
syntax match texMathDelim contained conceal cchar= "\s*\\\%([bB]igg\?r\?\|right\)\\rangle\>"
syntax match texMathDelim contained conceal cchar= "\\\%([bB]igg\?l\|left\)\\langle\>\s*"
syntax match texMathDelim contained conceal cchar= "\s*\\\%([bB]igg\?r\|right\)\\rangle\>"
else
syntax match texMathDelim contained conceal cchar= "\\\%([bB]igg\?l\?\|left\)\\langle\>\s*"
syntax match texMathDelim contained conceal cchar= "\s*\\\%([bB]igg\?r\?\|right\)\\rangle\>"
syntax match texMathDelim contained conceal cchar= "\\\%([bB]igg\?l\|left\)\\langle\>\s*"
syntax match texMathDelim contained conceal cchar= "\s*\\\%([bB]igg\?r\|right\)\\rangle\>"
endif
endfunction

Expand Down

0 comments on commit 2747dec

Please sign in to comment.