mirror of
https://github.com/vim/vim.git
synced 2026-04-28 22:46:03 +02:00
runtime(vim): Update base syntax and generator, improve command/function distinction
- Match Ex command modifiers and functions with the same name correctly. E.g., :browse and browse(). - Match full :eval command. closes: #17789 Signed-off-by: Doug Kearns <dougkearns@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
2e58b7684f
commit
2f7c957c8d
@@ -2,7 +2,7 @@
|
||||
" Language: Vim script
|
||||
" Maintainer: Hirohito Higashi <h.east.727 ATMARK gmail.com>
|
||||
" Doug Kearns <dougkearns@gmail.com>
|
||||
" Last Change: 2025 Jul 17
|
||||
" Last Change: 2025 Jul 18
|
||||
" Former Maintainer: Charles E. Campbell
|
||||
|
||||
" DO NOT CHANGE DIRECTLY.
|
||||
@@ -34,10 +34,22 @@ syn cluster vimCommentGroup contains=vimTodo,@Spell
|
||||
" regular vim commands {{{2
|
||||
" GEN_SYN_VIM: vimCommand normal, START_STR='syn keyword vimCommand contained', END_STR='nextgroup=vimBang'
|
||||
|
||||
" Lower priority :syn-match to allow for :command/function() distinction
|
||||
syn match vimCommand "\<chd\%[ir]\>" nextgroup=vimBang
|
||||
syn match vimCommand "\<co\%[py]\>" nextgroup=vimBang
|
||||
syn match vimCommand "\<d\%[elete]\>" nextgroup=vimBang
|
||||
syn match vimCommand "\<j\%[oin]\>" nextgroup=vimBang
|
||||
syn match vimCommand "\<sp\%[lit]\>" nextgroup=vimBang
|
||||
syn match vimCommand "\<sw\%[apname]\>" nextgroup=vimBang
|
||||
|
||||
" GEN_SYN_VIM: vimCommand modifier, START_STR='syn keyword vimCommandModifier', END_STR='skipwhite nextgroup=vimCommandModifierBang,@vimCmdList'
|
||||
" :filter is handled specially elsewhere
|
||||
syn match vimCommandModifierBang contained "\a\@1<=!" skipwhite nextgroup=@vimCmdList
|
||||
|
||||
" Lower priority :syn-match to allow for :command/function() distinction
|
||||
syn match vimCommand "\<bro\%[wse]\>" skipwhite nextgroup=vimCommandModifierBang,@vimCmdList
|
||||
syn match vimCommand "\<conf\%[irm]\>" skipwhite nextgroup=vimCommandModifierBang,@vimCmdList
|
||||
|
||||
" Lower priority for _new_ to distinguish constructors from the command.
|
||||
syn match vimCommand contained "\<new\>(\@!"
|
||||
syn match vimCommand contained "\<z[-+^.=]\=\>"
|
||||
@@ -230,7 +242,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,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 vimCmdList contains=vimAbb,vimAddress,vimAutocmd,vimAugroup,vimBehave,vimCall,vimCatch,vimCommandModifier,vimConst,vimDoautocmd,vimDebuggreedy,vimDef,vimDefFold,vimDelcommand,vimDelFunction,@vimEcho,vimElse,vimEnddef,vimEndfunction,vimEndif,vimEval,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
|
||||
@@ -1245,6 +1257,16 @@ syn region vimExecute
|
||||
\ contains=@vimContinue,@vimExprList
|
||||
\ transparent
|
||||
|
||||
syn region vimEval
|
||||
\ matchgroup=vimCommand
|
||||
\ start="\<ev\%[al]\>"
|
||||
\ skip=+\\|\|||\|\n\s*\%(\\\|["#]\\ \)+
|
||||
\ end="\ze|"
|
||||
\ excludenl end="$"
|
||||
\ nextgroup=vimCmdSep
|
||||
\ contains=@vimContinue,@vimExprList
|
||||
\ transparent
|
||||
|
||||
" Filter: {{{2
|
||||
" ======
|
||||
syn match vimExFilter "\<filt\%[er]\>" skipwhite nextgroup=vimExFilterBang,vimExFilterPattern
|
||||
@@ -2067,7 +2089,7 @@ unlet s:interfaces
|
||||
" (following Gautam Iyer's suggestion)
|
||||
" ==========================
|
||||
syn match vimFunc contained "\<\l\w*\ze\s*(" skipwhite nextgroup=vimOperParen contains=vimFuncName
|
||||
syn match vimUserFunc contained "\.\@1<=\l\w*\ze\s*(" skipwhite nextgroup=vimOperParen contains=vimFuncName
|
||||
syn match vimUserFunc contained "\.\@1<=\l\w*\ze\s*(" skipwhite nextgroup=vimOperParen
|
||||
syn match vimUserFunc contained "\<\%([[:upper:]_]\|\%(\h\w*\.\)\+\h\)\w*\ze\s*(" skipwhite nextgroup=vimOperParen contains=vim9MethodName,vim9Super,vim9This
|
||||
syn match vimUserFunc contained "\<\%(g:\)\=\%(\h\w*#\)\+\h\w*\ze\s*(" skipwhite nextgroup=vimOperParen contains=vimVarScope
|
||||
syn match vimUserFunc contained "\%(\<[sgbwtlav]:\|<[sS][iI][dD]>\)\%(\h\w*\.\)*\h\w*\ze\s*(" skipwhite nextgroup=vimOperParen contains=vimVarScope,vimNotation
|
||||
@@ -2224,6 +2246,7 @@ if !exists("skip_vim_syntax_inits")
|
||||
hi def link vimEnvvar PreProc
|
||||
hi def link vimError Error
|
||||
hi def link vimEscape Special
|
||||
hi def link vimEval vimCommand
|
||||
hi def link vimExFilter vimCommand
|
||||
hi def link vimExFilterBang vimBang
|
||||
hi def link vimExMark vimCommand
|
||||
|
||||
Reference in New Issue
Block a user