33" Maintainer: Hirohito Higashi <h.east.727 ATMARK gmail.com>
44" Doug Kearns <dougkearns@gmail.com>
55" URL: https://github.com/vim-jp/syntax-vim-ex
6- " Last Change: 2024 Jul 05
6+ " Last Change: 2024 Jul 17
77" Former Maintainer: Charles E. Campbell
88
99" DO NOT CHANGE DIRECTLY.
@@ -77,7 +77,11 @@ syn case match
7777" --- syntax here and above generated by mkvimvim ---
7878" Special Vim Highlighting (not automatic) {{{1
7979
80- " Set up folding commands for this syntax highlighting file {{{2
80+ " Set up commands for this syntax highlighting file {{{2
81+
82+ com ! -nargs =* Vim9 execute <q-args> s: vim9script ? " " : " contained"
83+ com ! -nargs =* VimL execute <q-args> s: vim9script ? " contained" : " "
84+
8185if exists (" g:vimsyn_folding" ) && g: vimsyn_folding = ~# ' [afhHlmpPrt]'
8286 if g: vimsyn_folding = ~# ' a'
8387 com ! -nargs =* VimFolda <args> fold
@@ -160,6 +164,14 @@ else
160164 let s: vimsyn_maxlines= 60
161165endif
162166
167+ " Nulls {{{2
168+ " =====
169+ Vim9 syn keyword vim9Null null null_blob null_channel null_class null_dict null_function null_job null_list null_object null_partial null_string
170+
171+ " Booleans {{{2
172+ " ========
173+ Vim9 syn keyword vim9Boolean true false
174+
163175" Numbers {{{2
164176" =======
165177syn case ignore
@@ -173,7 +185,8 @@ syn match vimNumber '\%(^\|\A\)\zs#\x\{6}' skipwhite nextgroup=vimGlobal,vimSub
173185syn case match
174186
175187" All vimCommands are contained by vimIsCommand. {{{2
176- syn cluster vimCmdList contains =vimAbb,vimAddress,vimAutoCmd,vimAugroup,vimBehave,vimCatch,vimDef,@vimEcho,vimEnddef,vimEndfunction,vimExecute,vimIsCommand,vimExtCmd,vimFor,vimFunction,vimGlobal,vimHighlight,vimLet,vimMap,vimMark,vimMatch,vimNotFunc,vimNorm,vimSet,vimSleep,vimSyntax,vimThrow,vimUnlet,vimUnmap,vimUserCmd,vimMenu,vimMenutranslate
188+ syn cluster vimCmdList contains =vimAbb,vimAddress,vimAutoCmd,vimAugroup,vimBehave,vimCatch,vimConst,vimDef,@vimEcho,vimEnddef,vimEndfunction,vimExecute,vimIsCommand,vimExtCmd,vimFor,vimFunction,vimGlobal,vimHighlight,vimLet,vimMap,vimMark,vimMatch,vimNotFunc,vimNorm,vimSet,vimSleep,vimSyntax,vimThrow,vimUnlet,vimUnmap,vimUserCmd,vimMenu,vimMenutranslate,@vim9CmdList
189+ syn cluster vim9CmdList contains =vim9Const,vim9Final,vim9For,vim9Var
177190syn match vimCmdSep " [:|]\+ " skipwhite nextgroup =@vimCmdList,vimSubst1
178191syn match vimIsCommand " \<\% (\h\w *\| [23]mat\% [ch]\)\> " contains =vimCommand
179192syn match vimVar contained " \<\h [a-zA-Z0-9#_]*\> "
@@ -184,7 +197,8 @@ syn match vimVar "\s\zs&t_k;"
184197syn match vimFBVar contained " \< [bwglstav]:\h [a-zA-Z0-9#_]*\> "
185198syn keyword vimCommand contained in
186199
187- syn cluster vimExprList contains =vimEnvvar,vimFunc,vimFuncVar,vimNumber,vimOper,vimOperParen,vimLetRegister,vimString,vimVar
200+ syn cluster vimExprList contains =vimEnvvar,vimFunc,vimNumber,vimOper,vimOperParen,vimLetRegister,vimString,vimVar,@vim9ExprList
201+ syn cluster vim9ExprList contains =vim9Boolean,vim9Null
188202
189203" Insertions And Appends: insert append {{{2
190204" (buftype != nofile test avoids having append, change, insert show up in the command window)
@@ -238,8 +252,8 @@ syn keyword vimAugroupKey contained aug[roup] skipwhite nextgroup=vimAugroupBan
238252
239253" Operators: {{{2
240254" =========
241- syn cluster vimOperGroup contains =vimEnvvar,vimFunc,vimFuncVar,vimOper,vimOperParen,vimNumber,vimString,vimRegister,@vimContinue,vim9Comment,vimVar
242- syn match vimOper " ||\| &&\| [-+*/%.!]" skipwhite nextgroup =vimString,vimSpecFile
255+ syn cluster vimOperGroup contains =vimEnvvar,vimFunc,vimFuncVar,vimOper,vimOperParen,vimNumber,vimString,vimRegister,@vimContinue,vim9Comment,vimVar,vimBoolean,vimNull
256+ syn match vimOper " ||\| &&\| [-+*/%.!]" skipwhite nextgroup =vimString,vimSpecFile
243257syn match vimOper " \% #=1\( ==\| !=\| >=\| <=\| =\~\| !\~\| >\| <\| =\| !\~ #\) [?#]\{ 0,2}" skipwhite nextgroup =vimString,vimSpecFile
244258syn match vimOper " \(\< is\|\< isnot\) [?#]\{ 0,2}\> " skipwhite nextgroup =vimString,vimSpecFile
245259syn region vimOperParen matchgroup =vimParenSep start =" (" end =" )" contains =@vimOperGroup
@@ -254,8 +268,8 @@ syn cluster vimFuncList contains=vimFuncBang,vimFunctionError,vimFuncKey,vimFunc
254268syn cluster vimDefList contains =vimFuncBang,vimFunctionError,vimDefKey,vimFuncSID,Tag
255269
256270syn cluster vimFuncBodyCommon contains =@vimCmdList,vimCmplxRepeat,vimContinue,vimCtrlChar,vimDef,vimEnvvar,vimFBVar,vimFunc,vimFunction,vimLetHereDoc,vimNotation,vimNotFunc,vimNumber,vimOper,vimOperParen,vimRegister,vimSearch,vimSpecFile,vimString,vimSubst,vimFuncFold
257- syn cluster vimFuncBodyList contains =@vimFuncBodyCommon,vimComment,vimLineComment,vimFuncVar,vimInsert
258- syn cluster vimDefBodyList contains =@vimFuncBodyCommon,vim9Comment,vim9LineComment
271+ syn cluster vimFuncBodyList contains =@vimFuncBodyCommon,vimComment,vimLineComment,vimFuncVar,vimInsert,vimConst,vimLet
272+ syn cluster vimDefBodyList contains =@vimFuncBodyCommon,vim9Comment,vim9LineComment,vim9Const,vim9Final,vim9Var,vim9Null,vim9Boolean,vim9For
259273
260274syn region vimFuncPattern contained matchgroup =vimOper start =" /" end =" $" contains =@vimSubstList
261275syn match vimFunction " \< fu\% [nction]\> " skipwhite nextgroup =vimCmdSep,vimComment,vimFuncPattern contains =vimFuncKey
@@ -276,7 +290,7 @@ syn keyword vimDefKey contained def
276290syn keyword vimMethodName contained empty len string
277291
278292syn region vimFuncParams contained matchgroup =Delimiter start =" (" skip =+ \n\s *\\\|\n\s *"\\ + end =" )" skipwhite skipnl nextgroup =vimFuncBody,vimFuncComment,vimEndfunction,vimFuncMod,vim9CommentError contains =vimFuncParam,@vimContinue
279- syn region vimDefParams contained matchgroup =Delimiter start =" (" end =" )" skipwhite skipnl nextgroup =vimDefBody,vimDefComment,vimEnddef,vimReturnType,vimCommentError contains =vimDefParam,vim9Comment
293+ syn region vimDefParams contained matchgroup =Delimiter start =" (" end =" )" skipwhite skipnl nextgroup =vimDefBody,vimDefComment,vimEnddef,vimReturnType,vimCommentError contains =vimDefParam,vim9Comment,vimFuncParamEquals
280294syn match vimFuncParam contained " \<\h\w *\>\|\.\.\. " skipwhite nextgroup =vimFuncParamEquals
281295syn match vimDefParam contained " \<\h\w *\> " skipwhite nextgroup =vimParamType,vimFuncParamEquals
282296
@@ -300,9 +314,9 @@ syn match vimFuncBlank contained "\s\+"
300314
301315" Types: {{{2
302316" =====
303- " vimTypes : new for vim9
317+
304318syn region vimReturnType contained start =" :\s " end =" $" matchgroup =vim9Comment end =" \z e[#"]" skipwhite skipnl nextgroup =vimDefBody,vimDefComment,vimEnddef,vimCommentError contains =vimTypeSep transparent
305- syn match vimParamType contained " :\s\+\a " skipwhite skipnl nextgroup =vimFuncParamEquals contains =vimTypeSep,@vimType
319+ syn match vimParamType contained " :\s " skipwhite skipnl nextgroup =@vimType contains =vimTypeSep
306320
307321syn match vimTypeSep contained " :\s\@ =" skipwhite nextgroup =@vimType
308322syn keyword vimType contained any blob bool channel float job number string void
@@ -377,35 +391,23 @@ if get(g:, "vimsyn_comment_strings", 1)
377391endif
378392
379393if s: vim9script
380- syn match vimComment excludenl + \s "[^\- :.%#=*].*$+ lc =1 contains =@vimCommentGroup,vimCommentString contained
381- syn match vimComment + \< endif\s\+ ".*$+ lc =5 contains =@vimCommentGroup,vimCommentString contained
382- syn match vimComment + \< else\s\+ ".*$+ lc =4 contains =@vimCommentGroup,vimCommentString contained
383- " Vim9 comments - TODO: might be highlighted while they don't work
384- syn match vim9Comment excludenl + \s #[^{].*$+ lc =1 contains =@vimCommentGroup,vimCommentString
385- syn match vim9Comment + \< endif\s\+ #[^{].*$+ lc =5 contains =@vimCommentGroup,vimCommentString
386- syn match vim9Comment + \< else\s\+ #[^{].*$+ lc =4 contains =@vimCommentGroup,vimCommentString
387- " Vim9 comment inside expression
388- " syn match vim9Comment +\s\zs#[^{].*$+ms=s+1 contains=@vimCommentGroup,vimCommentString
389- " syn match vim9Comment +^\s*#[^{].*$+ contains=@vimCommentGroup,vimCommentString
390- " syn match vim9Comment +^\s*#$+ contains=@vimCommentGroup,vimCommentString
391-
392394 syn cluster vimComment contains =vim9Comment
393395else
394- syn match vimComment excludenl + \s "[^\- :.%#=*].*$+ lc =1 contains =@vimCommentGroup,vimCommentString
395- syn match vimComment + \< endif\s\+ ".*$+ lc =5 contains =@vimCommentGroup,vimCommentString
396- syn match vimComment + \< else\s\+ ".*$+ lc =4 contains =@vimCommentGroup,vimCommentString
397- " Vim9 comments - TODO: might be highlighted while they don't work
398- syn match vim9Comment excludenl + \s #[^{].*$+ lc =1 contains =@vimCommentGroup,vimCommentString contained
399- syn match vim9Comment + \< endif\s\+ #[^{].*$+ lc =5 contains =@vimCommentGroup,vimCommentString contained
400- syn match vim9Comment + \< else\s\+ #[^{].*$+ lc =4 contains =@vimCommentGroup,vimCommentString contained
401- " Vim9 comment inside expression
402- syn match vim9Comment + \s\z s#[^{].*$+ ms =s + 1 contains =@vimCommentGroup,vimCommentString contained
403- syn match vim9Comment + ^\s *#[^{].*$+ contains =@vimCommentGroup,vimCommentString contained
404- syn match vim9Comment + ^\s *#$+ contains =@vimCommentGroup,vimCommentString contained
405-
406396 syn cluster vimComment contains =vimComment
407397endif
408398
399+ VimL syn match vimComment excludenl + \s " [^\-:.%#=*].*$+lc=1 contains=@vimCommentGroup,vimCommentString
400+ VimL syn match vimComment + \< endif \s\+ " .*$+lc=5 contains=@vimCommentGroup,vimCommentString
401+ VimL syn match vimComment + \< else \s\+ " .*$+lc=4 contains=@vimCommentGroup,vimCommentString
402+ " Vim9 comments - TODO: might be highlighted while they don't work
403+ Vim9 syn match vim9Comment excludenl + \s #[^{].* $ + lc = 1 contains= @v imCommentGroup,vimCommentString
404+ Vim9 syn match vim9Comment + \< endif \s\+ #[^{].* $ + lc = 5 contains= @v imCommentGroup,vimCommentString
405+ Vim9 syn match vim9Comment + \< else \s\+ #[^{].* $ + lc = 4 contains= @v imCommentGroup,vimCommentString
406+ " Vim9 comment inside expression
407+ Vim9 syn match vim9Comment + \s\z s#[^{].* $ + ms= s + 1 contains= @v imCommentGroup,vimCommentString contained
408+ Vim9 syn match vim9Comment + ^\s * #[^{].* $ + contains= @v imCommentGroup,vimCommentString contained
409+ Vim9 syn match vim9Comment + ^\s * #$ + contains= @v imCommentGroup,vimCommentString contained
410+
409411syn match vim9CommentError contained " #.*"
410412syn match vimCommentError contained + ".*+
411413
@@ -505,22 +507,32 @@ syn region vimSetString contained start=+="+hs=s+1 skip=+\\\\\|\\"+ end=+"+ co
505507syn match vimSetSep contained " [,:]"
506508syn match vimSetMod contained " &vim\=\| [!&?<]\| all&"
507509
508- " Let And Var : {{{2
509- " ===========
510- syn keyword vimLet let skipwhite nextgroup =vimVar,vimFuncVar,vimLetHereDoc ,vimLetRegister,vimVarList
511- syn keyword vimConst cons[t] skipwhite nextgroup =vimVar,vimLetHereDoc ,vimVarList
512- syn region vimVarList contained start =" \[ " end =" ]" contains =vimVar,vimContinue
510+ " Variable Declarations : {{{2
511+ " =====================
512+ VimL syn keyword vimLet let skipwhite nextgroup= vimVar,vimFuncVar,vimLetRegister,vimVarList
513+ VimL syn keyword vimConst cons [t ] skipwhite nextgroup= vimVar,vimVarList
514+ syn region vimVarList contained start =" \[ " end =" ]" contains =vimVar,@ vimContinue
513515
514- syn keyword vimUnlet unl[et] skipwhite nextgroup =vimUnletBang,vimUnletVars
516+ VimL syn keyword vimUnlet unl [et ] skipwhite nextgroup= vimUnletBang,vimUnletVars
515517syn match vimUnletBang contained " !" skipwhite nextgroup =vimUnletVars
516518syn region vimUnletVars contained start =" $\I\|\h " skip =" \n\s *\\ " end =" $" end =" |" contains =vimVar,vimEnvvar,vimContinue,vimString,vimNumber
517519
518520VimFoldh syn region vimLetHereDoc matchgroup =vimLetHereDocStart start =' =<<\s *\% (trim\s\+\% (eval\s\+\)\=\| eval\s\+\% (trim\s\+\)\=\)\=\z (\L\S *\) ' matchgroup =vimLetHereDocStop end =' ^\s *\z 1\s *$' extend
519- syn keyword vimLet var skipwhite nextgroup =vimVar,vimFuncVar,vimLetHereDoc
521+
522+ Vim9 syn keyword vim9Const const skipwhite nextgroup= vim9Variable,vim9VariableList
523+ Vim9 syn keyword vim9Final final skipwhite nextgroup= vim9Variable,vim9VariableList
524+ Vim9 syn keyword vim9Var var skipwhite nextgroup= vim9Variable,vim9VariableList
525+
526+ syn match vim9Variable contained " \<\h\w *\> " skipwhite nextgroup =vimTypeSep,vimLetHereDoc
527+ syn region vim9VariableList contained start =" \[ " end =" ]" contains =vim9Variable,@vimContinue
520528
521529" For: {{{2
522530" ===
523- syn keyword vimFor for skipwhite nextgroup =vimVar,vimVarList
531+ if s: vim9script
532+ syn keyword vim9For for skipwhite nextgroup =vim9Variable,vim9VariableList
533+ else
534+ syn keyword vimFor for skipwhite nextgroup =vimVar,vimVarList
535+ endif
524536
525537" Abbreviations: {{{2
526538" =============
@@ -834,13 +846,9 @@ syn match vimCtrlChar "[--]"
834846
835847" Beginners - Patterns that involve ^ {{{2
836848" =========
837- if s: vim9script
838- syn region vim9LineComment start =+ ^[ \t :]*\z s#.*$+ skip =+ \n\s *\\\|\n\s *#\\ + end =" $" contains =@vimCommentGroup,vimCommentString,vim9CommentTitle
839- syn region vimLineComment start =+ ^[ \t :]*\z s".*$+ skip =+ \n\s *\\\|\n\s *"\\ + end =" $" contains =@vimCommentGroup,vimCommentString,vimCommentTitle contained
840- else
841- syn region vimLineComment start =+ ^[ \t :]*\z s".*$+ skip =+ \n\s *\\\|\n\s *"\\ + end =" $" contains =@vimCommentGroup,vimCommentString,vimCommentTitle
842- syn region vim9LineComment start =+ ^[ \t :]*\z s#.*$+ skip =+ \n\s *\\\|\n\s *#\\ + end =" $" contains =@vimCommentGroup,vimCommentString,vim9CommentTitle contained
843- endif
849+ Vim9 syn region vim9LineComment start = + ^[ \t :]* \z s#.* $ + skip = + \n \s * \\ \| \n \s * #\\ + end = " $" contains= @v imCommentGroup,vimCommentString,vim9CommentTitle
850+ VimL syn region vimLineComment start = + ^[ \t :]* \z s" .*$+ skip=+\n \s *\\ \| \n \s *" \\ + end = " $" contains= @v imCommentGroup,vimCommentString,vimCommentTitle
851+
844852syn match vimCommentTitle ' "\s *\% ([sS]:\|\h\w *#\)\=\u\w *\(\s\+\u\w *\) *:' hs =s + 1 contained contains =vimCommentTitleLeader,vimTodo,@vimCommentGroup
845853syn match vim9CommentTitle ' #\s *\% ([sS]:\|\h\w *#\)\=\u\w *\(\s\+\u\w *\) *:' hs =s + 1 contained contains =vim9CommentTitleLeader,vimTodo,@vimCommentGroup
846854
@@ -1083,7 +1091,6 @@ if !exists("skip_vim_syntax_inits")
10831091 hi def link vimBufnrWarn vimWarn
10841092 endif
10851093
1086- hi def link vim9Vim9ScriptArg Special
10871094 hi def link vimAbb vimCommand
10881095 hi def link vimAddress vimMark
10891096 hi def link vimAugroupBang vimBang
@@ -1102,11 +1109,8 @@ if !exists("skip_vim_syntax_inits")
11021109 hi def link vimCommand Statement
11031110 hi def link vimComment Comment
11041111 hi def link vimCommentError vimError
1105- hi def link vim9Comment Comment
1106- hi def link vim9CommentError vimError
11071112 hi def link vimCommentString vimString
11081113 hi def link vimCommentTitle PreProc
1109- hi def link vim9CommentTitle PreProc
11101114 hi def link vimCondHL vimCommand
11111115 hi def link vimConst vimCommand
11121116 hi def link vimContinue Special
@@ -1173,7 +1177,6 @@ if !exists("skip_vim_syntax_inits")
11731177 hi def link vimLetHereDocStop Special
11741178 hi def link vimLetRegister Special
11751179 hi def link vimLineComment vimComment
1176- hi def link vim9LineComment vimComment
11771180 hi def link vimMapBang vimBang
11781181 hi def link vimMapModKey vimFuncSID
11791182 hi def link vimMapMod vimBracket
@@ -1219,7 +1222,6 @@ if !exists("skip_vim_syntax_inits")
12191222 hi def link vimSetMod vimOption
12201223 hi def link vimSetSep Statement
12211224 hi def link vimSetString vimString
1222- hi def link vim9Vim9Script vimCommand
12231225 hi def link vimShebang PreProc
12241226 hi def link vimSleep vimCommand
12251227 hi def link vimSleepArg Constant
@@ -1280,13 +1282,29 @@ if !exists("skip_vim_syntax_inits")
12801282 hi def link vimUserFunc Normal
12811283 hi def link vimVar Identifier
12821284 hi def link vimWarn WarningMsg
1285+
1286+ hi def link vim9Boolean Boolean
1287+ hi def link vim9Comment Comment
1288+ hi def link vim9CommentError vimError
1289+ hi def link vim9CommentTitle PreProc
1290+ hi def link vim9Const vimCommand
1291+ hi def link vim9Final vimCommand
1292+ hi def link vim9For vimCommand
1293+ hi def link vim9LineComment vimComment
1294+ hi def link vim9Null Constant
1295+ hi def link vim9Var vimCommand
1296+ hi def link vim9Variable vimVar
1297+ hi def link vim9Vim9Script vimCommand
1298+ hi def link vim9Vim9ScriptArg Special
12831299endif
12841300
12851301" Current Syntax Variable: {{{2
12861302let b: current_syntax = " vim"
12871303
12881304" ---------------------------------------------------------------------
12891305" Cleanup: {{{1
1306+ delc Vim9
1307+ delc VimL
12901308delc VimFolda
12911309delc VimFoldf
12921310delc VimFoldh
0 commit comments