vim-patch:ce1d196: runtime(vim): Update base syntax, improve :match highlighting (#34912)

- Match the range prefix separately as a count.
- Match an explicit count of 1, rarely used but seen in the wild.
- Allow whitespace between the count and command.

closes: vim/vim#17717

ce1d1969f3

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
This commit is contained in:
zeertzjq
2025-07-13 16:39:19 +08:00
committed by GitHub
parent 73fbc693b5
commit 3e7f5d95aa

View File

@ -225,7 +225,7 @@ syn cluster vim9CmdList contains=vim9Abstract,vim9Class,vim9Const,vim9Enum,vim9E
syn match vimCmdSep "\\\@1<!|" skipwhite nextgroup=@vimCmdList,vimSubst1,@vimFunc
syn match vimCmdSep ":\+" skipwhite nextgroup=@vimCmdList,vimSubst1
syn match vimCount contained "\d\+"
syn match vimIsCommand "\<\%(\h\w*\|[23]mat\%[ch]\)\>" nextgroup=vimBang contains=vimCommand
syn match vimIsCommand "\<\h\w*\>" nextgroup=vimBang contains=vimCommand
syn match vimBang contained "!"
syn match vimWhitespace contained "\s\+"
@ -1437,12 +1437,18 @@ endif
" Match: {{{2
" =====
syn match vimMatch "\<[23]\=mat\%[ch]\>" skipwhite nextgroup=vimMatchGroup,vimMatchNone
syn match vimMatchGroup contained "[[:alnum:]._-]\+" skipwhite nextgroup=vimMatchPattern
syn match vimMatch "\<\%([1-3]\s*\)\=mat\%[ch]\>" skipwhite nextgroup=vimMatchGroup,vimMatchNone contains=vimCount
syn match vimMatchGroup contained "[[:alnum:]._-]\+" skipwhite nextgroup=vimMatchPattern
syn case ignore
syn keyword vimMatchNone contained none
syn case match
syn region vimMatchPattern contained matchgroup=Delimiter start="\z([!#$%&'()*+,-./:;<=>?@[\]^_`{}~]\)" skip="\\\\\|\\\z1" end="\z1" contains=@vimSubstList oneline
syn region vimMatchPattern contained
\ matchgroup=Delimiter
\ start="\z([!#$%&'()*+,-./:;<=>?@[\]^_`{}~]\)"
\ skip="\\\\\|\\\z1"
\ end="\z1"
\ contains=@vimSubstList
\ oneline
" Normal: {{{2
" ======