commit 3e7f5d95aa25943e26d88a75fc55785229c36e34
parent 73fbc693b593faa62337aa3ae8142bb3f5798541
Author: zeertzjq <zeertzjq@outlook.com>
Date: Sun, 13 Jul 2025 16:39:19 +0800
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
https://github.com/vim/vim/commit/ce1d1969f304af122eaf10b405dad013ac0246f7
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Diffstat:
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim
@@ -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
" ======