commit 8fe4e120a2de558fddbb91ba5438d78f3dbd926a
parent 85e6feedb0de9c9a5e29ba90815937ed5032f5b4
Author: zeertzjq <zeertzjq@outlook.com>
Date: Sun, 6 Jul 2025 07:18:46 +0800
Merge pull request #34800 from zeertzjq/vim-a9b5e4a
vim-patch: Vim syntax updates
Diffstat:
1 file changed, 29 insertions(+), 10 deletions(-)
diff --git 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 "\<z[-+^.=]\=\>"
syn keyword vimOnlyCommand contained fix[del] op[en] sh[ell] P[rint]
@@ -81,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 "\<Conceal\>"
-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
@@ -212,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,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,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<!|" skipwhite nextgroup=@vimCmdList,vimSubst1,vimFunc
syn match vimCmdSep ":\+" skipwhite nextgroup=@vimCmdList,vimSubst1
@@ -793,7 +801,7 @@ syn region vimUserCmdBlock contained
\ matchgroup=vimSep
\ start="{"
\ end="^\s*\zs}"
- \ contains=@vimDefBodyList
+ \ contains=@vimDefBodyList,@vimUserCmdList
syn match vimDelcommand "\<delc\%[ommand]\>" skipwhite nextgroup=vimDelcommandAttr,vimDelcommandName
syn match vimDelcommandAttr contained "-buffer\>" skipwhite nextgroup=vimDelcommandName
@@ -1232,7 +1240,6 @@ syn region vimExecute
" Filter: {{{2
" ======
syn match vimExFilter "\<filt\%[er]\>" 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 +1254,7 @@ syn region vimExFilterPattern contained
\ skipwhite nextgroup=@vimCmdList
\ contains=@vimSubstList
\ oneline
+syn match vimExFilterBang contained "\a\@1<=!" skipwhite nextgroup=vimExFilterPattern
" Grep and Make: {{{2
" =============
@@ -1383,7 +1391,7 @@ syn match vimNotation contained "\%#=1\%(\\\|<lt>\)\=<\%([scamd2-4]-\)\{0,4}scro
syn match vimNotation contained "\%#=1\%(\\\|<lt>\)\=<\%(sid\|nop\|nul\|lt\|drop\)>" contains=vimBracket
syn match vimNotation contained "\%#=1\%(\\\|<lt>\)\=<\%(snr\|plug\|cursorhold\|ignore\|cmd\|scriptcmd\|focus\%(gained\|lost\)\)>" contains=vimBracket
" syn match vimNotation contained '\%(\\\|<lt>\)\=<C-R>[0-9a-z"%#:.\-=]'he=e-1 contains=vimBracket
-syn match vimNotation contained '\%#=1\%(\\\|<lt>\)\=<\%(q-\)\=\%(line[12]\|count\|bang\|reg\|args\|mods\|f-args\|f-mods\|lt\)>' contains=vimBracket
+syn match vimNotation contained '\%#=1\%(\\\|<lt>\)\=<\%([fq]-\)\=\%(line[12]\|count\|bang\|reg\|args\|mods\|lt\)>' contains=vimBracket skipwhite nextgroup=vimSubst1
syn match vimNotation contained "\%#=1\%(\\\|<lt>\)\=<\%([cas]file\|abuf\|amatch\|cexpr\|cword\|cWORD\|client\|stack\|script\|sf\=lnum\)>" contains=vimBracket
syn match vimNotation contained "\%#=1\%(\\\|<lt>\)\=<\%([scamd]-\)\{0,4}char-\%(\d\+\|0\o\+\|0x\x\+\)>" contains=vimBracket
@@ -1413,7 +1421,13 @@ syn match vimSynMenuPath contained ".*\ze:" nextgroup=vimSynMenuColon contains=v
syn match vimSynMenuColon contained ":" nextgroup=vimSynMenuName
syn match vimSynMenuName contained "\w\+"
-syn cluster vimExUserCmdList contains=vimCompilerSet,vimSynMenu
+" runtime/syntax/syncolor.vim
+syn match vimSynColor "\<SynColor\>" skipwhite nextgroup=vimSynColorGroup
+syn match vimSynColorGroup contained "\<\h\w*\>" skipwhite nextgroup=vimHiKeyList contains=vimGroup
+syn match vimSynLink "\<SynLink\>" 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
" ====================
@@ -1661,8 +1675,9 @@ endif
syn match vimHighlight "\<hi\%[ghlight]\>" 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 "\%(\<Conceal\>\)\@!\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
@@ -2160,6 +2175,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 +2211,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
@@ -2491,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