From 3e7f5d95aa25943e26d88a75fc55785229c36e34 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 13 Jul 2025 16:39:19 +0800 Subject: [PATCH] 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 --- runtime/syntax/vim.vim | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index ee69457af4..508caf5bac 100644 --- 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" 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 " ======