From 518f95e27e2f720a4c367c70215d644e35ef97fd Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 6 Jul 2025 06:20:48 +0800 Subject: [PATCH 1/4] vim-patch:a9b5e4a: runtime(vim): Update base-syntax and generator, generate command modifiers Generate Ex command modifiers from the modifier table in src/ex_docmd.c closes: vim/vim#17564 https://github.com/vim/vim/commit/a9b5e4af43ef1f03f20ebcf980f4dd555a12694d Co-authored-by: Doug Kearns --- runtime/syntax/vim.vim | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index a92d233922..6a95308543 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -30,6 +30,11 @@ endfunction syn keyword vimTodo contained COMBAK FIXME TODO XXX syn cluster vimCommentGroup contains=vimTodo,@Spell +" GEN_SYN_VIM: vimCommand modifier, START_STR='syn keyword vimCommandModifier', END_STR='skipwhite nextgroup=vimCommandModifierBang,@vimCmdList' +syn keyword vimCommandModifier abo[veleft] bel[owright] bo[tright] bro[wse] conf[irm] hid[e] hor[izontal] kee[pmarks] keepj[umps] keepp[atterns] keepa[lt] lefta[bove] leg[acy] loc[kmarks] noa[utocmd] nos[wapfile] rightb[elow] san[dbox] sil[ent] tab to[pleft] uns[ilent] verb[ose] vert[ical] vim9[cmd] skipwhite nextgroup=vimCommandModifierBang,@vimCmdList +" :filter is handled specially elsewhere +syn match vimCommandModifierBang contained "\a\@1<=!" skipwhite nextgroup=@vimCmdList + " Special and plugin vim commands {{{2 syn match vimCommand contained "\" syn keyword vimOnlyCommand contained fix[del] op[en] sh[ell] P[rint] @@ -212,7 +217,7 @@ syn match vimNumber '\<0z\%(\x\x\)\+\%(\.\%(\x\x\)\+\)*' skipwhite nextgroup=@vi syn case match " All vimCommands are contained by vimIsCommand. {{{2 -syn cluster vimCmdList contains=vimAbb,vimAddress,vimAutocmd,vimAugroup,vimBehave,vimCall,vimCatch,vimConst,vimDoautocmd,vimDebuggreedy,vimDef,vimDefFold,vimDelcommand,vimDelFunction,@vimEcho,vimElse,vimEnddef,vimEndfunction,vimEndif,vimExecute,vimIsCommand,vimExtCmd,vimExFilter,vimExMark,vimFor,vimFunction,vimFunctionFold,vimGrep,vimGrepAdd,vimGlobal,vimHelpgrep,vimHighlight,vimImport,vimLet,vimLoadkeymap,vimLockvar,vimMake,vimMap,vimMark,vimMatch,vimNotFunc,vimNormal,vimProfdel,vimProfile,vimRedir,vimSet,vimSleep,vimSort,vimSyntax,vimThrow,vimUniq,vimUnlet,vimUnlockvar,vimUnmap,vimUserCmd,vimVimgrep,vimVimgrepadd,vimMenu,vimMenutranslate,@vim9CmdList,@vimExUserCmdList,vimLua,vimMzScheme,vimPerl,vimPython,vimPython3,vimPythonX,vimRuby,vimTcl +syn cluster vimCmdList contains=vimAbb,vimAddress,vimAutocmd,vimAugroup,vimBehave,vimCall,vimCatch,vimCommandModifier,vimConst,vimDoautocmd,vimDebuggreedy,vimDef,vimDefFold,vimDelcommand,vimDelFunction,@vimEcho,vimElse,vimEnddef,vimEndfunction,vimEndif,vimExecute,vimIsCommand,vimExtCmd,vimExFilter,vimExMark,vimFor,vimFunction,vimFunctionFold,vimGrep,vimGrepAdd,vimGlobal,vimHelpgrep,vimHighlight,vimImport,vimLet,vimLoadkeymap,vimLockvar,vimMake,vimMap,vimMark,vimMatch,vimNotFunc,vimNormal,vimProfdel,vimProfile,vimRedir,vimSet,vimSleep,vimSort,vimSyntax,vimThrow,vimUniq,vimUnlet,vimUnlockvar,vimUnmap,vimUserCmd,vimVimgrep,vimVimgrepadd,vimMenu,vimMenutranslate,@vim9CmdList,@vimExUserCmdList,vimLua,vimMzScheme,vimPerl,vimPython,vimPython3,vimPythonX,vimRuby,vimTcl syn cluster vim9CmdList contains=vim9Abstract,vim9Class,vim9Const,vim9Enum,vim9Export,vim9Final,vim9For,vim9Interface,vim9Type,vim9Var syn match vimCmdSep "\\\@1" skipwhite nextgroup=vimExFilterBang,vimExFilterPattern -syn match vimExFilterBang contained "\a\@1<=!" skipwhite nextgroup=vimExFilterPattern syn region vimExFilterPattern contained \ start="[[:ident:]]" \ end="\ze[[:space:]\n]" @@ -1247,6 +1251,7 @@ syn region vimExFilterPattern contained \ skipwhite nextgroup=@vimCmdList \ contains=@vimSubstList \ oneline +syn match vimExFilterBang contained "\a\@1<=!" skipwhite nextgroup=vimExFilterPattern " Grep and Make: {{{2 " ============= @@ -2160,6 +2165,8 @@ if !exists("skip_vim_syntax_inits") hi def link vimCatch vimCommand hi def link vimCmplxRepeat SpecialChar hi def link vimCommand Statement + hi def link vimCommandModifier vimCommand + hi def link vimCommandModifierBang vimBang hi def link vimComment Comment hi def link vimCommentError vimError hi def link vimCommentString vimString @@ -2194,7 +2201,7 @@ if !exists("skip_vim_syntax_inits") hi def link vimError Error hi def link vimEscape Special hi def link vimExFilter vimCommand - hi def link vimExFilterBang vimCommand + hi def link vimExFilterBang vimBang hi def link vimExMark vimCommand hi def link vimFBVar vimVar hi def link vimFgBgAttrib vimHiAttrib From 0ea7a65299ce44f5c4bdd14a03a132c37ab05888 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 6 Jul 2025 06:35:53 +0800 Subject: [PATCH 2/4] vim-patch:c233c2e: runtime(vim): Update base-syntax and generator, match all default highlight groups - Match Conceal, ComplMatchIns, MsgArea, Terminal, and User[1-9] highlight groups. - Generate the vimGroup syntax group from runtime/syncolor.vim. - Match :SynColor and :SynLink as special user commands. fixes vim/vim#17467 closes: vim/vim#17556 https://github.com/vim/vim/commit/c233c2e6a54778e034d62473e48421f25b2f5069 Co-authored-by: Doug Kearns --- runtime/syntax/vim.vim | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index 6a95308543..7fc7184ac6 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -86,12 +86,15 @@ syn keyword vimAutoEvent contained User skipwhite nextgroup=vimUserAutoEvent syn match vimUserAutoEvent contained "\<\h\w*\>" skipwhite nextgroup=vimUserAutoEventSep,vimAutocmdMod,vimAutocmdBlock " Highlight commonly used Groupnames {{{2 -syn keyword vimGroup contained Comment Constant String Character Number Boolean Float Identifier Function Statement Conditional Repeat Label Operator Keyword Exception PreProc Include Define Macro PreCondit Type StorageClass Structure Typedef Special SpecialChar Tag Delimiter SpecialComment Debug Underlined Ignore Error Todo +" GEN_SYN_VIM: vimGroup, START_STR='syn keyword vimGroup contained', END_STR='' +syn keyword vimGroup contained Added Boolean Changed Character Comment Conditional Constant Debug Define Delimiter Error Exception Float Function Identifier Ignore Include Keyword Label Macro Number Operator PreCondit PreProc Removed Repeat Special SpecialChar SpecialComment Statement StorageClass String Structure Tag Todo Type Typedef Underlined " Default highlighting groups {{{2 -syn keyword vimHLGroup contained ErrorMsg IncSearch ModeMsg NonText StatusLine StatusLineNC EndOfBuffer VertSplit DiffText DiffTextAdd PmenuSbar TabLineSel TabLineFill Cursor lCursor QuickFixLine CursorLineSign CursorLineFold CurSearch PmenuKind PmenuKindSel PmenuMatch PmenuMatchSel PmenuExtra PmenuExtraSel ComplMatchIns Normal Directory LineNr CursorLineNr MoreMsg Question Search SpellBad SpellCap SpellRare SpellLocal PmenuThumb Pmenu PmenuSel SpecialKey Title WarningMsg WildMenu Folded FoldColumn SignColumn Visual DiffAdd DiffChange DiffDelete TabLine CursorColumn CursorLine ColorColumn MatchParen StatusLineTerm StatusLineTermNC CursorIM LineNrAbove LineNrBelow +" GEN_SYN_VIM: vimHLGroup, START_STR='syn keyword vimHLGroup contained', END_STR='' +syn keyword vimHLGroup contained ErrorMsg IncSearch ModeMsg NonText StatusLine StatusLineNC EndOfBuffer VertSplit DiffText DiffTextAdd PmenuSbar TabLineSel TabLineFill Cursor lCursor QuickFixLine CursorLineSign CursorLineFold CurSearch PmenuKind PmenuKindSel PmenuMatch PmenuMatchSel PmenuExtra PmenuExtraSel Normal Directory LineNr CursorLineNr MoreMsg Question Search SpellBad SpellCap SpellRare SpellLocal PmenuThumb Pmenu PmenuSel SpecialKey Title WarningMsg WildMenu Folded FoldColumn SignColumn Visual DiffAdd DiffChange DiffDelete TabLine CursorColumn CursorLine ColorColumn MatchParen StatusLineTerm StatusLineTermNC CursorIM +syn keyword vimHLGroup contained ComplMatchIns LineNrAbove LineNrBelow MsgArea User1 User2 User3 User4 User5 User6 User7 User8 User9 syn match vimHLGroup contained "\" -syn keyword vimOnlyHLGroup contained Menu Scrollbar ToolbarButton ToolbarLine Tooltip VisualNOS +syn keyword vimOnlyHLGroup contained Menu PopupSelected MessageWindow PopupNotification Scrollbar Terminal ToolbarButton ToolbarLine Tooltip VisualNOS syn keyword nvimHLGroup contained FloatBorder FloatFooter FloatTitle MsgSeparator NormalFloat NormalNC Substitute TermCursor VisualNC Whitespace WinBar WinBarNC WinSeparator "}}}2 syn case match @@ -217,7 +220,7 @@ syn match vimNumber '\<0z\%(\x\x\)\+\%(\.\%(\x\x\)\+\)*' skipwhite nextgroup=@vi syn case match " All vimCommands are contained by vimIsCommand. {{{2 -syn cluster vimCmdList contains=vimAbb,vimAddress,vimAutocmd,vimAugroup,vimBehave,vimCall,vimCatch,vimCommandModifier,vimConst,vimDoautocmd,vimDebuggreedy,vimDef,vimDefFold,vimDelcommand,vimDelFunction,@vimEcho,vimElse,vimEnddef,vimEndfunction,vimEndif,vimExecute,vimIsCommand,vimExtCmd,vimExFilter,vimExMark,vimFor,vimFunction,vimFunctionFold,vimGrep,vimGrepAdd,vimGlobal,vimHelpgrep,vimHighlight,vimImport,vimLet,vimLoadkeymap,vimLockvar,vimMake,vimMap,vimMark,vimMatch,vimNotFunc,vimNormal,vimProfdel,vimProfile,vimRedir,vimSet,vimSleep,vimSort,vimSyntax,vimThrow,vimUniq,vimUnlet,vimUnlockvar,vimUnmap,vimUserCmd,vimVimgrep,vimVimgrepadd,vimMenu,vimMenutranslate,@vim9CmdList,@vimExUserCmdList,vimLua,vimMzScheme,vimPerl,vimPython,vimPython3,vimPythonX,vimRuby,vimTcl +syn cluster vimCmdList contains=vimAbb,vimAddress,vimAutocmd,vimAugroup,vimBehave,vimCall,vimCatch,vimCommandModifier,vimConst,vimDoautocmd,vimDebuggreedy,vimDef,vimDefFold,vimDelcommand,vimDelFunction,@vimEcho,vimElse,vimEnddef,vimEndfunction,vimEndif,vimExecute,vimIsCommand,vimExtCmd,vimExFilter,vimExMark,vimFor,vimFunction,vimFunctionFold,vimGrep,vimGrepAdd,vimGlobal,vimHelpgrep,vimHighlight,vimImport,vimLet,vimLoadkeymap,vimLockvar,vimMake,vimMap,vimMark,vimMatch,vimNotFunc,vimNormal,vimProfdel,vimProfile,vimRedir,vimSet,vimSleep,vimSort,vimSyntax,vimSynColor,vimSynLink,vimThrow,vimUniq,vimUnlet,vimUnlockvar,vimUnmap,vimUserCmd,vimVimgrep,vimVimgrepadd,vimMenu,vimMenutranslate,@vim9CmdList,@vimExUserCmdList,vimLua,vimMzScheme,vimPerl,vimPython,vimPython3,vimPythonX,vimRuby,vimTcl syn cluster vim9CmdList contains=vim9Abstract,vim9Class,vim9Const,vim9Enum,vim9Export,vim9Final,vim9For,vim9Interface,vim9Type,vim9Var syn match vimCmdSep "\\\@1" skipwhite nextgroup=vimSynColorGroup +syn match vimSynColorGroup contained "\<\h\w*\>" skipwhite nextgroup=vimHiKeyList contains=vimGroup +syn match vimSynLink "\" skipwhite nextgroup=vimSynLinkGroup +syn match vimSynLinkGroup contained "\<\h\w*\>" skipwhite nextgroup=vimGroup contains=vimGroup + +syn cluster vimExUserCmdList contains=vimCompilerSet,vimSynColor,vimSynLink,vimSynMenu " Errors And Warnings: {{{2 " ==================== @@ -1666,8 +1675,9 @@ endif syn match vimHighlight "\" skipwhite nextgroup=vimHiBang,@vimHighlightCluster syn match vimHiBang contained "\a\@1<=!" skipwhite nextgroup=@vimHighlightCluster -syn match vimHiGroup contained "\i\+" syn case ignore +" Conceal is a generated low-priority match +syn match vimHiGroup contained "\%(\\)\@!\i\+" syn keyword vimHiNone contained NONE syn keyword vimHiAttrib contained none bold inverse italic nocombine reverse standout strikethrough underline undercurl underdashed underdotted underdouble syn keyword vimFgBgAttrib contained none bg background fg foreground @@ -2498,6 +2508,8 @@ if !exists("skip_vim_syntax_inits") hi def link vim9Vim9Script vimCommand hi def link vimCompilerSet vimCommand + hi def link vimSynColor vimCommand + hi def link vimSynLink vimCommand hi def link vimSynMenu vimCommand hi def link vimSynMenuPath vimMenuName From 728b3e3d50c696c026e801b21cf2155fb4d885ba Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 6 Jul 2025 06:44:07 +0800 Subject: [PATCH 3/4] vim-patch:a8b8660: runtime(vim): Update base-syntax, match escape sequences in :command blocks - Match escape sequences in :command replacement blocks. - Match :substitute after escape sequences (a temporary fix until Ex commands are contained). fixes: vim/vim#17326 closes: vim/vim#17663 https://github.com/vim/vim/commit/a8b86605f39f168178dfbdc1971df4e19c636310 Co-authored-by: Doug Kearns --- runtime/syntax/vim.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index 7fc7184ac6..ae13544431 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -801,7 +801,7 @@ syn region vimUserCmdBlock contained \ matchgroup=vimSep \ start="{" \ end="^\s*\zs}" - \ contains=@vimDefBodyList + \ contains=@vimDefBodyList,@vimUserCmdList syn match vimDelcommand "\" skipwhite nextgroup=vimDelcommandAttr,vimDelcommandName syn match vimDelcommandAttr contained "-buffer\>" skipwhite nextgroup=vimDelcommandName @@ -1391,7 +1391,7 @@ syn match vimNotation contained "\%#=1\%(\\\|\)\=<\%([scamd2-4]-\)\{0,4}scro syn match vimNotation contained "\%#=1\%(\\\|\)\=<\%(sid\|nop\|nul\|lt\|drop\)>" contains=vimBracket syn match vimNotation contained "\%#=1\%(\\\|\)\=<\%(snr\|plug\|cursorhold\|ignore\|cmd\|scriptcmd\|focus\%(gained\|lost\)\)>" contains=vimBracket " syn match vimNotation contained '\%(\\\|\)\=[0-9a-z"%#:.\-=]'he=e-1 contains=vimBracket -syn match vimNotation contained '\%#=1\%(\\\|\)\=<\%(q-\)\=\%(line[12]\|count\|bang\|reg\|args\|mods\|f-args\|f-mods\|lt\)>' contains=vimBracket +syn match vimNotation contained '\%#=1\%(\\\|\)\=<\%([fq]-\)\=\%(line[12]\|count\|bang\|reg\|args\|mods\|lt\)>' contains=vimBracket skipwhite nextgroup=vimSubst1 syn match vimNotation contained "\%#=1\%(\\\|\)\=<\%([cas]file\|abuf\|amatch\|cexpr\|cword\|cWORD\|client\|stack\|script\|sf\=lnum\)>" contains=vimBracket syn match vimNotation contained "\%#=1\%(\\\|\)\=<\%([scamd]-\)\{0,4}char-\%(\d\+\|0\o\+\|0x\x\+\)>" contains=vimBracket From 55f003671d80b79019a9a9eecc378604de0cc4d7 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 6 Jul 2025 06:45:30 +0800 Subject: [PATCH 4/4] vim-patch:5911ac5: runtime(vim): Update base-syntax, match :filetype in functions closes: vim/vim#17671 https://github.com/vim/vim/commit/5911ac5023594a55a3654c9050d4924ca3218d22 Co-authored-by: Doug Kearns --- runtime/syntax/vim.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index ae13544431..317df819fd 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -220,7 +220,7 @@ syn match vimNumber '\<0z\%(\x\x\)\+\%(\.\%(\x\x\)\+\)*' skipwhite nextgroup=@vi syn case match " All vimCommands are contained by vimIsCommand. {{{2 -syn cluster vimCmdList contains=vimAbb,vimAddress,vimAutocmd,vimAugroup,vimBehave,vimCall,vimCatch,vimCommandModifier,vimConst,vimDoautocmd,vimDebuggreedy,vimDef,vimDefFold,vimDelcommand,vimDelFunction,@vimEcho,vimElse,vimEnddef,vimEndfunction,vimEndif,vimExecute,vimIsCommand,vimExtCmd,vimExFilter,vimExMark,vimFor,vimFunction,vimFunctionFold,vimGrep,vimGrepAdd,vimGlobal,vimHelpgrep,vimHighlight,vimImport,vimLet,vimLoadkeymap,vimLockvar,vimMake,vimMap,vimMark,vimMatch,vimNotFunc,vimNormal,vimProfdel,vimProfile,vimRedir,vimSet,vimSleep,vimSort,vimSyntax,vimSynColor,vimSynLink,vimThrow,vimUniq,vimUnlet,vimUnlockvar,vimUnmap,vimUserCmd,vimVimgrep,vimVimgrepadd,vimMenu,vimMenutranslate,@vim9CmdList,@vimExUserCmdList,vimLua,vimMzScheme,vimPerl,vimPython,vimPython3,vimPythonX,vimRuby,vimTcl +syn cluster vimCmdList contains=vimAbb,vimAddress,vimAutocmd,vimAugroup,vimBehave,vimCall,vimCatch,vimCommandModifier,vimConst,vimDoautocmd,vimDebuggreedy,vimDef,vimDefFold,vimDelcommand,vimDelFunction,@vimEcho,vimElse,vimEnddef,vimEndfunction,vimEndif,vimExecute,vimIsCommand,vimExtCmd,vimExFilter,vimExMark,vimFiletype,vimFor,vimFunction,vimFunctionFold,vimGrep,vimGrepAdd,vimGlobal,vimHelpgrep,vimHighlight,vimImport,vimLet,vimLoadkeymap,vimLockvar,vimMake,vimMap,vimMark,vimMatch,vimNotFunc,vimNormal,vimProfdel,vimProfile,vimRedir,vimSet,vimSleep,vimSort,vimSyntax,vimSynColor,vimSynLink,vimThrow,vimUniq,vimUnlet,vimUnlockvar,vimUnmap,vimUserCmd,vimVimgrep,vimVimgrepadd,vimMenu,vimMenutranslate,@vim9CmdList,@vimExUserCmdList,vimLua,vimMzScheme,vimPerl,vimPython,vimPython3,vimPythonX,vimRuby,vimTcl syn cluster vim9CmdList contains=vim9Abstract,vim9Class,vim9Const,vim9Enum,vim9Export,vim9Final,vim9For,vim9Interface,vim9Type,vim9Var syn match vimCmdSep "\\\@1