From 8893b7b340e012b714cc42f0562f37405be32d51 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 27 May 2024 22:38:10 +0800 Subject: vim-patch:393708c: runtime(vim): re-generate vim syntax from generator (#29041) related: vim/vim#14861 https://github.com/vim/vim/commit/393708cff6f92ee34b450b054dfdb73a65f5bcf7 Co-authored-by: Christian Brabandt --- runtime/syntax/vim.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'runtime/syntax/vim.vim') diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index 4fc640bab1..22c1e16a30 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -60,7 +60,8 @@ syn case ignore 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 " Default highlighting groups {{{2 -syn keyword vimHLGroup contained ErrorMsg IncSearch ModeMsg NonText StatusLine StatusLineNC EndOfBuffer VertSplit DiffText PmenuSbar TabLineSel TabLineFill Cursor lCursor QuickFixLine CursorLineSign CursorLineFold CurSearch PmenuKind PmenuKindSel 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 Conceal MatchParen CursorIM LineNrAbove LineNrBelow +syn keyword vimHLGroup contained ErrorMsg IncSearch ModeMsg NonText StatusLine StatusLineNC EndOfBuffer VertSplit DiffText PmenuSbar TabLineSel TabLineFill Cursor lCursor QuickFixLine CursorLineSign CursorLineFold CurSearch PmenuKind PmenuKindSel 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 CursorIM LineNrAbove LineNrBelow +syn match vimHLGroup contained "\" syn keyword vimOnlyHLGroup contained Menu Scrollbar StatusLineTerm StatusLineTermNC ToolbarButton ToolbarLine Tooltip VisualNOS syn keyword nvimHLGroup contained FloatBorder FloatFooter FloatTitle MsgSeparator NormalFloat NormalNC Substitute TermCursor TermCursorNC VisualNC Whitespace WinBar WinBarNC WinSeparator "}}}2 -- cgit From 78d3f4742872f535ebc75500afde4858985c40d8 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 6 Jun 2024 06:40:11 +0800 Subject: vim-patch:92f4e91: runtime(vim): Update base-syntax, allow whitespace before :substitute pattern (#29210) Allow whitespace between the :substitute command and its pattern argument. Although unusual, it is supported and there are examples in the wild. Match Vi compatible :substitute commands like :s\/{string}/. See :help E1270. fixes: vim/vim#14920 closes: vim/vim#14923 https://github.com/vim/vim/commit/92f4e915908962da2c1969a8d60f1563e06ee00e Co-authored-by: Doug Kearns --- runtime/syntax/vim.vim | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'runtime/syntax/vim.vim') diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index 22c1e16a30..6cb75f3af4 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -428,12 +428,10 @@ syn match vimStringInterpolationBrace contained "}}" syn cluster vimSubstList contains=vimPatSep,vimPatRegion,vimPatSepErr,vimSubstTwoBS,vimSubstRange,vimNotation syn cluster vimSubstRepList contains=vimSubstSubstr,vimSubstTwoBS,vimNotation syn cluster vimSubstList add=vimCollection -syn match vimSubst "^\s*\%(s\%[ubstitute]\|sm\%[agic]\|sno\%[magic]\)\>[\"#|]\@!" nextgroup=vimSubstPat -syn match vimSubst "^\s*\%(s\%[ubstitute]\|sm\%[agic]\|sno\%[magic]\)_\@=" nextgroup=vimSubstPat -syn match vimSubst "^\s*\%(s\%[ubstitute]\|sm\%[agic]\>\|sno\%[magic]\)\ze#.\{-}#.\{-}#" nextgroup=vimSubstPat -syn match vimSubst1 contained "\%(s\%[ubstitute]\|sm\%[agic]\>\|sno\%[magic]\)\>[\"#|]\@!" nextgroup=vimSubstPat -syn match vimSubst1 contained "\%(s\%[ubstitute]\|sm\%[agic]\>\|sno\%[magic]\)_\@=" nextgroup=vimSubstPat -syn match vimSubst1 contained "\%(s\%[ubstitute]\|sm\%[agic]\>\|sno\%[magic]\)\ze#.\{-}#.\{-}#" nextgroup=vimSubstPat +syn match vimSubst "^\s*\%(s\%[ubstitute]\|sm\%[agic]\|sno\%[magic]\)\>" skipwhite nextgroup=vimSubstPat +syn match vimSubst "^\s*\%(s\%[ubstitute]\|sm\%[agic]\|sno\%[magic]\)[_#]\@=" skipwhite nextgroup=vimSubstPat +syn match vimSubst1 contained "\%(s\%[ubstitute]\|sm\%[agic]\>\|sno\%[magic]\)\>" skipwhite nextgroup=vimSubstPat +syn match vimSubst1 contained "\%(s\%[ubstitute]\|sm\%[agic]\>\|sno\%[magic]\)[_#]\@=" skipwhite nextgroup=vimSubstPat " TODO: Vim9 illegal separators for abbreviated :s form are [-.:], :su\%[...] required " : # is allowed but "not recommended" (see :h pattern-delimiter) syn region vimSubstPat contained matchgroup=vimSubstDelim start="\z([!#$%&'()*+,-./:;<=>?@[\]^_`{}~]\)"rs=s+1 skip="\\\\\|\\\z1" end="\z1"re=e-1,me=e-1 contains=@vimSubstList nextgroup=vimSubstRep4 oneline @@ -446,6 +444,10 @@ syn match vimSubstTwoBS contained "\\\\" syn match vimSubstFlagErr contained "[^< \t\r|]\+" contains=vimSubstFlags syn match vimSubstFlags contained "[&cegiIlnpr#]\+" +" Vi compatibility +syn match vimSubstDelim contained "\\" +syn match vimSubstPat contained "\\\ze[/?&]" contains=vimSubstDelim nextgroup=vimSubstRep4 + " 'String': {{{2 syn match vimString "[^(,]'[^']\{-}\zs'" -- cgit From c7799b1a23f82128e793448165ae88b403f9ef17 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 12 Jun 2024 10:22:22 +0800 Subject: vim-patch:059cbe8: runtime(vim): Update base-syntax, match multiline continued comments (vim/vim#13936) Match multiline (continued) line comments. Continued tail comments are not supported yet. https://github.com/vim/vim/commit/059cbe8933550e4f2b10ab564fb4398e95280198 Co-authored-by: dkearns --- runtime/syntax/vim.vim | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'runtime/syntax/vim.vim') diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index 6cb75f3af4..d916a666c9 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -806,16 +806,17 @@ syn match vimCtrlChar "[- -]" " Beginners - Patterns that involve ^ {{{2 " ========= if s:vim9script - syn match vimLineComment +^[ \t:]*".*$+ contains=@vimCommentGroup,vimCommentString,vimCommentTitle contained - syn match vim9LineComment +^[ \t:]*#.*$+ contains=@vimCommentGroup,vimCommentString,vim9CommentTitle + syn region vim9LineComment start=+^[ \t:]*\zs#.*$+ skip=+\n\s*\\\|\n\s*#\\ + end="$" contains=@vimCommentGroup,vimCommentString,vim9CommentTitle + syn region vimLineComment start=+^[ \t:]*\zs".*$+ skip=+\n\s*\\\|\n\s*"\\ + end="$" contains=@vimCommentGroup,vimCommentString,vimCommentTitle contained else - syn match vimLineComment +^[ \t:]*".*$+ contains=@vimCommentGroup,vimCommentString,vimCommentTitle - syn match vim9LineComment +^[ \t:]*#.*$+ contains=@vimCommentGroup,vimCommentString,vim9CommentTitle contained + syn region vimLineComment start=+^[ \t:]*\zs".*$+ skip=+\n\s*\\\|\n\s*"\\ + end="$" contains=@vimCommentGroup,vimCommentString,vimCommentTitle + syn region vim9LineComment start=+^[ \t:]*\zs#.*$+ skip=+\n\s*\\\|\n\s*#\\ + end="$" contains=@vimCommentGroup,vimCommentString,vim9CommentTitle contained endif syn match vimCommentTitle '"\s*\%([sS]:\|\h\w*#\)\=\u\w*\(\s\+\u\w*\)*:'hs=s+1 contained contains=vimCommentTitleLeader,vimTodo,@vimCommentGroup syn match vim9CommentTitle '#\s*\%([sS]:\|\h\w*#\)\=\u\w*\(\s\+\u\w*\)*:'hs=s+1 contained contains=vim9CommentTitleLeader,vimTodo,@vimCommentGroup + syn match vimContinue "^\s*\zs\\" -syn match vimContinueComment '^\s*\zs["#]\\ .*' contained +syn match vimContinueComment '^\s*\zs["#]\\ .*' syn cluster vimContinue contains=vimContinue,vimContinueComment syn region vimString start="^\s*\\\z(['"]\)" skip='\\\\\|\\\z1' end="\z1" oneline keepend contains=@vimStringGroup,vimContinue syn match vimCommentTitleLeader '"\s\+'ms=s+1 contained -- cgit From bbe69b4022b577a801653991a8b7f7f2ab869e97 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 12 Jun 2024 10:23:09 +0800 Subject: vim-patch:959c3c8: runtime(vim): Update base-syntax, configurable comment string highlighting (vim/vim#14931) Allow highlighting of strings within comments to be disabled by setting g:vimsyn_comment_strings to false. https://github.com/vim/vim/commit/959c3c887b2e52c7141b2a09a53634481911b1b7 Co-authored-by: dkearns --- runtime/syntax/vim.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'runtime/syntax/vim.vim') diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index d916a666c9..d16d62dc4a 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -359,7 +359,9 @@ syn region vimUserCmdBlock contained matchgroup=vimSep start="{" end="}" contain " Lower Priority Comments: after some vim commands... {{{2 " ======================= -syn region vimCommentString contained oneline start='\S\s\+"'ms=e end='"' +if get(g:, "vimsyn_comment_strings", 1) + syn region vimCommentString contained oneline start='\S\s\+"'ms=e end='"' +endif if s:vim9script syn match vimComment excludenl +\s"[^\-:.%#=*].*$+lc=1 contains=@vimCommentGroup,vimCommentString contained -- cgit From 0600754d8d24457d23c3eb1d9c89b1d30c429ad0 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 15 Jun 2024 05:59:48 +0800 Subject: vim-patch:a3bddb7: runtime(vim): Update base-syntax, match :catch and :throw args (vim/vim#14989) Match :catch /{pattern}/ and :throw {expr1}. https://github.com/vim/vim/commit/a3bddb759e77c52431a93a68674790dd02647cd1 Co-authored-by: dkearns --- runtime/syntax/vim.vim | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'runtime/syntax/vim.vim') diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index d16d62dc4a..b233359f1e 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -60,9 +60,9 @@ syn case ignore 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 " Default highlighting groups {{{2 -syn keyword vimHLGroup contained ErrorMsg IncSearch ModeMsg NonText StatusLine StatusLineNC EndOfBuffer VertSplit DiffText PmenuSbar TabLineSel TabLineFill Cursor lCursor QuickFixLine CursorLineSign CursorLineFold CurSearch PmenuKind PmenuKindSel 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 CursorIM LineNrAbove LineNrBelow +syn keyword vimHLGroup contained ErrorMsg IncSearch ModeMsg NonText StatusLine StatusLineNC EndOfBuffer VertSplit DiffText 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 LineNrAbove LineNrBelow syn match vimHLGroup contained "\" -syn keyword vimOnlyHLGroup contained Menu Scrollbar StatusLineTerm StatusLineTermNC ToolbarButton ToolbarLine Tooltip VisualNOS +syn keyword vimOnlyHLGroup contained Menu Scrollbar ToolbarButton ToolbarLine Tooltip VisualNOS syn keyword nvimHLGroup contained FloatBorder FloatFooter FloatTitle MsgSeparator NormalFloat NormalNC Substitute TermCursor TermCursorNC VisualNC Whitespace WinBar WinBarNC WinSeparator "}}}2 syn case match @@ -165,7 +165,7 @@ syn match vimNumber '\%(^\|\A\)\zs#\x\{6}' skipwhite nextgroup=vimGlobal,vimSub syn case match " All vimCommands are contained by vimIsCommand. {{{2 -syn cluster vimCmdList contains=vimAbb,vimAddress,vimAutoCmd,vimAugroup,vimBehave,vimDef,@vimEcho,vimEnddef,vimEndfunction,vimExecute,vimIsCommand,vimExtCmd,vimFor,vimFunction,vimGlobal,vimHighlight,vimLet,vimMap,vimMark,vimNotFunc,vimNorm,vimSet,vimSyntax,vimUnlet,vimUnmap,vimUserCmd,vimMenu,vimMenutranslate +syn cluster vimCmdList contains=vimAbb,vimAddress,vimAutoCmd,vimAugroup,vimBehave,vimCatch,vimDef,@vimEcho,vimEnddef,vimEndfunction,vimExecute,vimIsCommand,vimExtCmd,vimFor,vimFunction,vimGlobal,vimHighlight,vimLet,vimMap,vimMark,vimNotFunc,vimNorm,vimSet,vimSyntax,vimThrow,vimUnlet,vimUnmap,vimUserCmd,vimMenu,vimMenutranslate syn match vimCmdSep "[:|]\+" skipwhite nextgroup=@vimCmdList,vimSubst1 syn match vimIsCommand "\<\%(\h\w*\|[23]mat\%[ch]\)\>" contains=vimCommand syn match vimVar contained "\<\h[a-zA-Z0-9#_]*\>" @@ -196,6 +196,11 @@ syn match vimBehave "\" nextgroup=vimBehaveBang,vimBehaveModel,vi syn match vimBehaveBang contained "\a\@1<=!" nextgroup=vimBehaveModel skipwhite syn keyword vimBehaveModel contained mswin xterm +" Exception Handling {{{2 +syn keyword vimThrow th[row] skipwhite nextgroup=@vimExprList +syn keyword vimCatch cat[ch] skipwhite nextgroup=vimCatchPattern +syn region vimCatchPattern contained matchgroup=Delimiter start="\z([!#$%&'()*+,-./:;<=>?@[\]^_`{}~]\)" skip="\\\\\|\\\z1" end="\z1" contains=@vimSubstList oneline + " Filetypes {{{2 " ========= syn match vimFiletype "\ Date: Sat, 15 Jun 2024 06:05:51 +0800 Subject: vim-patch:262e25e: runtime(vim): Update base-syntax, match :sleep arg Match :sleep arg properly including a lone "m" with a leading count. closes: vim/vim#15003 https://github.com/vim/vim/commit/262e25e5a10438770dc9e23e0d5ffcb116f05d0f Co-authored-by: Doug Kearns --- runtime/syntax/vim.vim | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'runtime/syntax/vim.vim') diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index b233359f1e..de2b4ef223 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -165,7 +165,7 @@ syn match vimNumber '\%(^\|\A\)\zs#\x\{6}' skipwhite nextgroup=vimGlobal,vimSub syn case match " All vimCommands are contained by vimIsCommand. {{{2 -syn cluster vimCmdList contains=vimAbb,vimAddress,vimAutoCmd,vimAugroup,vimBehave,vimCatch,vimDef,@vimEcho,vimEnddef,vimEndfunction,vimExecute,vimIsCommand,vimExtCmd,vimFor,vimFunction,vimGlobal,vimHighlight,vimLet,vimMap,vimMark,vimNotFunc,vimNorm,vimSet,vimSyntax,vimThrow,vimUnlet,vimUnmap,vimUserCmd,vimMenu,vimMenutranslate +syn cluster vimCmdList contains=vimAbb,vimAddress,vimAutoCmd,vimAugroup,vimBehave,vimCatch,vimDef,@vimEcho,vimEnddef,vimEndfunction,vimExecute,vimIsCommand,vimExtCmd,vimFor,vimFunction,vimGlobal,vimHighlight,vimLet,vimMap,vimMark,vimNotFunc,vimNorm,vimSet,vimSleep,vimSyntax,vimThrow,vimUnlet,vimUnmap,vimUserCmd,vimMenu,vimMenutranslate syn match vimCmdSep "[:|]\+" skipwhite nextgroup=@vimCmdList,vimSubst1 syn match vimIsCommand "\<\%(\h\w*\|[23]mat\%[ch]\)\>" contains=vimCommand syn match vimVar contained "\<\h[a-zA-Z0-9#_]*\>" @@ -647,6 +647,12 @@ syn match vimNotFunc "\\|\\|\\|\" skipwhi syn match vimNorm "\" + " Syntax: {{{2 "======= syn match vimGroupList contained "[^[:space:],]\+\%(\s*,\s*[^[:space:],]\+\)*" contains=vimGroupSpecial @@ -1190,6 +1196,9 @@ if !exists("skip_vim_syntax_inits") hi def link vimSetSep Statement hi def link vimSetString vimString hi def link vim9Vim9Script vimCommand + hi def link vimSleep vimCommand + hi def link vimSleepArg Constant + hi def link vimSleepBang vimBang hi def link vimSpecFile Identifier hi def link vimSpecFileMod vimSpecFile hi def link vimSpecial Type -- cgit From bb487ea12e279bb7ab599d55eb027f1c34e4ecbe Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 15 Jun 2024 21:28:23 +0800 Subject: vim-patch:ae321b5: runtime(vim): Update base-syntax, match shebang lines (vim/vim#15011) (#29351) Match shebang lines in Vim9 and legacy script. Mark these as an error if they appear anywhere other than the first line of a legacy-script file. In Vim9 script these match as normal line comments rather than an error. https://github.com/vim/vim/commit/ae321b51f7531b23545d64c3a98ed991a31dd5ee Co-authored-by: dkearns --- runtime/syntax/vim.vim | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'runtime/syntax/vim.vim') diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index de2b4ef223..a3b0117e9d 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -828,6 +828,12 @@ endif syn match vimCommentTitle '"\s*\%([sS]:\|\h\w*#\)\=\u\w*\(\s\+\u\w*\)*:'hs=s+1 contained contains=vimCommentTitleLeader,vimTodo,@vimCommentGroup syn match vim9CommentTitle '#\s*\%([sS]:\|\h\w*#\)\=\u\w*\(\s\+\u\w*\)*:'hs=s+1 contained contains=vim9CommentTitleLeader,vimTodo,@vimCommentGroup +" allowed anywhere in the file +if !s:vim9script + syn match vimShebangError "^\s*\zs#!.*" display +endif +syn match vimShebang "\%^#!.*" display + syn match vimContinue "^\s*\zs\\" syn match vimContinueComment '^\s*\zs["#]\\ .*' syn cluster vimContinue contains=vimContinue,vimContinueComment @@ -1058,6 +1064,7 @@ if !exists("skip_vim_syntax_inits") hi def link vimHiCtermError vimError hi def link vimHiKeyError vimError hi def link vimMapModErr vimError + hi def link vimShebangError vimError hi def link vimSubstFlagErr vimError hi def link vimSynCaseError vimError hi def link vimSynFoldMethodError vimError @@ -1196,6 +1203,7 @@ if !exists("skip_vim_syntax_inits") hi def link vimSetSep Statement hi def link vimSetString vimString hi def link vim9Vim9Script vimCommand + hi def link vimShebang PreProc hi def link vimSleep vimCommand hi def link vimSleepArg Constant hi def link vimSleepBang vimBang -- cgit From 6796f7cf61eb49d10bc066bb3205a5c4bdc8db24 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 22 Jun 2024 19:46:13 +0800 Subject: vim-patch:fc64ac0: runtime(vim): Update base-syntax, fix function tail comments (#29450) Match Vim9-script comments after :def and :enddef and legacy-script comments after :func and :endfunc, in any definition context. Highlight incorrect comment types after these commands as errors. fixes: vim/vim#15062 closes: vim/vim#15072 https://github.com/vim/vim/commit/fc64ac0be2c4f9446798de4d66b029526d1afa85 Co-authored-by: Doug Kearns --- runtime/syntax/vim.vim | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) (limited to 'runtime/syntax/vim.vim') diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index a3b0117e9d..a3bfc70267 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -266,19 +266,19 @@ syn match vimFuncSID contained "\<[sg]:" syn keyword vimFuncKey contained fu[nction] syn keyword vimDefKey contained def -syn region vimFuncParams contained matchgroup=Delimiter start="(" skip=+\n\s*\\\|\n\s*"\\ + end=")" skipwhite skipnl nextgroup=vimFuncBody,vimFuncComment,vimEndfunction,vimFuncMod contains=vimFuncParam,@vimContinue -syn region vimDefParams contained matchgroup=Delimiter start="(" end=")" skipwhite skipnl nextgroup=vimDefBody,vimDefComment,vimEnddef,vimReturnType contains=vimDefParam,vim9Comment +syn region vimFuncParams contained matchgroup=Delimiter start="(" skip=+\n\s*\\\|\n\s*"\\ + end=")" skipwhite skipnl nextgroup=vimFuncBody,vimFuncComment,vimEndfunction,vimFuncMod,vim9CommentError contains=vimFuncParam,@vimContinue +syn region vimDefParams contained matchgroup=Delimiter start="(" end=")" skipwhite skipnl nextgroup=vimDefBody,vimDefComment,vimEnddef,vimReturnType,vimCommentError contains=vimDefParam,vim9Comment syn match vimFuncParam contained "\<\h\w*\>\|\.\.\." skipwhite nextgroup=vimFuncParamEquals syn match vimDefParam contained "\<\h\w*\>" skipwhite nextgroup=vimParamType,vimFuncParamEquals syn match vimFuncParamEquals contained "=" skipwhite nextgroup=@vimExprList -syn match vimFuncMod contained "\<\%(abort\|closure\|dict\|range\)\>" skipwhite skipnl nextgroup=vimFuncBody,vimFuncComment,vimEndfunction,vimFuncMod +syn match vimFuncMod contained "\<\%(abort\|closure\|dict\|range\)\>" skipwhite skipnl nextgroup=vimFuncBody,vimFuncComment,vimEndfunction,vimFuncMod,vim9CommentError -syn region vimFuncBody contained start="^" matchgroup=vimCommand end="\" contains=@vimFuncBodyList -syn region vimDefBody contained start="^" matchgroup=vimCommand end="\" contains=@vimDefBodyList +syn region vimFuncBody contained start="^.\=" matchgroup=vimCommand end="\" contains=@vimFuncBodyList skipwhite nextgroup=vimCmdSep,vimComment,vim9CommentError +syn region vimDefBody contained start="^.\=" matchgroup=vimCommand end="\" contains=@vimDefBodyList skipwhite nextgroup=vimCmdSep,vim9Comment,vimCommentError -syn match vimEndfunction "\" -syn match vimEnddef "\" +syn match vimEndfunction "\" skipwhite nextgroup=vimCmdSep,vimComment,vim9CommentError +syn match vimEnddef "\" skipwhite nextgroup=vimCmdSep,vim9Comment,vimCommentError if exists("g:vimsyn_folding") && g:vimsyn_folding =~# 'f' syn region vimFuncFold start="^\s*:\=\s*fu\%[nction]\>!\=\s*\%(<[sS][iI][dD]>\|[sg]:\)\=\%(\i\|[#.]\|{.\{-1,}}\)\+\s*(" end="^\s*:\=\s*endf\%[unction]\>" contains=vimFunction fold keepend extend transparent @@ -292,7 +292,7 @@ syn match vimFuncBlank contained "\s\+" " Types: {{{2 " ===== " vimTypes : new for vim9 -syn region vimReturnType contained start=":\s" end="$" matchgroup=vim9Comment end="\ze#" skipwhite skipnl nextgroup=vimDefBody,vimDefComment,vimEnddef contains=vimTypeSep transparent +syn region vimReturnType contained start=":\s" end="$" matchgroup=vim9Comment end="\ze[#"]" skipwhite skipnl nextgroup=vimDefBody,vimDefComment,vimEnddef,vimCommentError contains=vimTypeSep transparent syn match vimParamType contained ":\s\+\a" skipwhite skipnl nextgroup=vimFuncParamEquals contains=vimTypeSep,@vimType syn match vimTypeSep contained ":\s\@=" skipwhite nextgroup=@vimType @@ -398,6 +398,9 @@ else syn cluster vimComment contains=vimComment endif +syn match vim9CommentError contained "#.*" +syn match vimCommentError contained +".*+ + " Environment Variables: {{{2 " ===================== syn match vimEnvvar "\$\I\i*" @@ -868,12 +871,12 @@ endif " Allows users to specify the type of embedded script highlighting " they want: (perl/python/ruby/tcl support) " g:vimsyn_embed == 0 : don't embed any scripts -" g:vimsyn_embed =~# 'l' : embed lua -" g:vimsyn_embed =~# 'm' : embed mzscheme -" g:vimsyn_embed =~# 'p' : embed perl -" g:vimsyn_embed =~# 'P' : embed python -" g:vimsyn_embed =~# 'r' : embed ruby -" g:vimsyn_embed =~# 't' : embed tcl +" g:vimsyn_embed =~# 'l' : embed Lua +" g:vimsyn_embed =~# 'm' : embed MzScheme +" g:vimsyn_embed =~# 'p' : embed Perl +" g:vimsyn_embed =~# 'P' : embed Python +" g:vimsyn_embed =~# 'r' : embed Ruby +" g:vimsyn_embed =~# 't' : embed Tcl if !exists("g:vimsyn_embed") let g:vimsyn_embed = 'l' endif @@ -1089,7 +1092,9 @@ if !exists("skip_vim_syntax_inits") hi def link vimCmplxRepeat SpecialChar hi def link vimCommand Statement hi def link vimComment Comment + hi def link vimCommentError vimError hi def link vim9Comment Comment + hi def link vim9CommentError vimError hi def link vimCommentString vimString hi def link vimCommentTitle PreProc hi def link vim9CommentTitle PreProc @@ -1098,7 +1103,7 @@ if !exists("skip_vim_syntax_inits") hi def link vimContinue Special hi def link vimContinueComment vimComment hi def link vimCtrlChar SpecialChar - hi def link vimDefComment vimComment + hi def link vimDefComment vim9Comment hi def link vimDefKey vimCommand hi def link vimDefParam vimVar hi def link vimEcho vimCommand -- cgit From 055a222797e46a046a365707e4e0dc957e46c648 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 8 Jul 2024 06:51:23 +0800 Subject: vim-patch:e85fdc7: runtime(vim): Update base-syntax, improve :match command highlighting (#29607) Match group and pattern arguments to :match commands. closes: vim/vim#15096 https://github.com/vim/vim/commit/e85fdc730e2a538db9af72a255207aa3d5f3fafc Co-authored-by: Doug Kearns --- runtime/syntax/vim.vim | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'runtime/syntax/vim.vim') diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index a3bfc70267..e5b0c24447 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -165,7 +165,7 @@ syn match vimNumber '\%(^\|\A\)\zs#\x\{6}' skipwhite nextgroup=vimGlobal,vimSub syn case match " All vimCommands are contained by vimIsCommand. {{{2 -syn cluster vimCmdList contains=vimAbb,vimAddress,vimAutoCmd,vimAugroup,vimBehave,vimCatch,vimDef,@vimEcho,vimEnddef,vimEndfunction,vimExecute,vimIsCommand,vimExtCmd,vimFor,vimFunction,vimGlobal,vimHighlight,vimLet,vimMap,vimMark,vimNotFunc,vimNorm,vimSet,vimSleep,vimSyntax,vimThrow,vimUnlet,vimUnmap,vimUserCmd,vimMenu,vimMenutranslate +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 syn match vimCmdSep "[:|]\+" skipwhite nextgroup=@vimCmdList,vimSubst1 syn match vimIsCommand "\<\%(\h\w*\|[23]mat\%[ch]\)\>" contains=vimCommand syn match vimVar contained "\<\h[a-zA-Z0-9#_]*\>" @@ -645,6 +645,15 @@ endif syn match vimNotFunc "\\|\\|\\|\" skipwhite nextgroup=vimOper,vimOperParen,vimVar,vimFunc,vimNotation +" Match: {{{2 +" ===== +syn match vimMatch "\<[23]\=mat\%[ch]\>" skipwhite nextgroup=vimMatchGroup,vimMatchNone +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 + " Norm: {{{2 " ==== syn match vimNorm "\ Date: Fri, 12 Jul 2024 07:11:54 +0800 Subject: vim-patch:9.1.0568: Cannot expand paths from 'cdpath' setting Problem: Cannot expand paths from 'cdpath' setting (Daniel Hahler) Solution: Implement 'cdpath' completion, add the new 'dir_in_path' completion type (LemonBoy) fixes vim/vim#374 closes: vim/vim#15205 https://github.com/vim/vim/commit/a20bf69a3b32024cb7809be87af33bf9dc490a19 Co-authored-by: LemonBoy --- runtime/syntax/vim.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/syntax/vim.vim') diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index e5b0c24447..4262636496 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -353,7 +353,7 @@ endif syn case ignore syn keyword vimUserAttrbKey contained bar ban[g] cou[nt] ra[nge] com[plete] n[args] re[gister] " GEN_SYN_VIM: vimUserAttrbCmplt, START_STR='syn keyword vimUserAttrbCmplt contained', END_STR='' -syn keyword vimUserAttrbCmplt contained arglist augroup behave buffer color command compiler cscope diff_buffer dir environment event expression file file_in_path filetype function help highlight history keymap locale mapclear mapping menu messages syntax syntime option packadd runtime shellcmd sign tag tag_listfiles user var breakpoint scriptnames +syn keyword vimUserAttrbCmplt contained arglist augroup behave buffer color command compiler cscope diff_buffer dir environment event expression file file_in_path filetype function help highlight history keymap locale mapclear mapping menu messages syntax syntime option packadd runtime shellcmd sign tag tag_listfiles user var breakpoint scriptnames dir_in_path syn keyword vimUserAttrbCmplt contained custom customlist nextgroup=vimUserAttrbCmpltFunc,vimUserCmdError syn match vimUserAttrbCmpltFunc contained ",\%([sS]:\|<[sS][iI][dD]>\)\=\%(\h\w*\%([.#]\h\w*\)\+\|\h\w*\)"hs=s+1 nextgroup=vimUserCmdError -- cgit From 167d0e5a6cf801bfb9b56477ba914e4f5337fe56 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 18 Jul 2024 09:08:47 +0800 Subject: vim-patch:d65e58f: runtime(vim): Update base-syntax, match types in Vim9 variable declarations (#29780) Match types in Vim9 variable declarations. Match Vim9 boolean and null literals. These are not matched in all contexts yet. related: vim/vim#15277 https://github.com/vim/vim/commit/d65e58f6f930f769cae869aeedf00192a242c5cc Co-authored-by: Doug Kearns --- runtime/syntax/vim.vim | 128 ++++++++++++++++++++++++++++--------------------- 1 file changed, 73 insertions(+), 55 deletions(-) (limited to 'runtime/syntax/vim.vim') diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index 4262636496..2d3e8beed5 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -69,7 +69,11 @@ syn case match " Special Vim Highlighting (not automatic) {{{1 -" Set up folding commands for this syntax highlighting file {{{2 +" Set up commands for this syntax highlighting file {{{2 + +com! -nargs=* Vim9 execute s:vim9script ? "" : "contained" +com! -nargs=* VimL execute s:vim9script ? "contained" : "" + if exists("g:vimsyn_folding") && g:vimsyn_folding =~# '[afhHlmpPrt]' if g:vimsyn_folding =~# 'a' com! -nargs=* VimFolda fold @@ -152,6 +156,14 @@ else let s:vimsyn_maxlines= 60 endif +" Nulls {{{2 +" ===== +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 + +" Booleans {{{2 +" ======== +Vim9 syn keyword vim9Boolean true false + " Numbers {{{2 " ======= syn case ignore @@ -165,7 +177,8 @@ syn match vimNumber '\%(^\|\A\)\zs#\x\{6}' skipwhite nextgroup=vimGlobal,vimSub syn case match " All vimCommands are contained by vimIsCommand. {{{2 -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 +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 +syn cluster vim9CmdList contains=vim9Const,vim9Final,vim9For,vim9Var syn match vimCmdSep "[:|]\+" skipwhite nextgroup=@vimCmdList,vimSubst1 syn match vimIsCommand "\<\%(\h\w*\|[23]mat\%[ch]\)\>" contains=vimCommand syn match vimVar contained "\<\h[a-zA-Z0-9#_]*\>" @@ -176,7 +189,8 @@ syn match vimVar "\s\zs&t_k;" syn match vimFBVar contained "\<[bwglstav]:\h[a-zA-Z0-9#_]*\>" syn keyword vimCommand contained in -syn cluster vimExprList contains=vimEnvvar,vimFunc,vimFuncVar,vimNumber,vimOper,vimOperParen,vimLetRegister,vimString,vimVar +syn cluster vimExprList contains=vimEnvvar,vimFunc,vimNumber,vimOper,vimOperParen,vimLetRegister,vimString,vimVar,@vim9ExprList +syn cluster vim9ExprList contains=vim9Boolean,vim9Null " Insertions And Appends: insert append {{{2 " (buftype != nofile test avoids having append, change, insert show up in the command window) @@ -230,8 +244,8 @@ syn keyword vimAugroupKey contained aug[roup] skipwhite nextgroup=vimAugroupBan " Operators: {{{2 " ========= -syn cluster vimOperGroup contains=vimEnvvar,vimFunc,vimFuncVar,vimOper,vimOperParen,vimNumber,vimString,vimRegister,@vimContinue,vim9Comment,vimVar -syn match vimOper "||\|&&\|[-+*/%.!]" skipwhite nextgroup=vimString,vimSpecFile +syn cluster vimOperGroup contains=vimEnvvar,vimFunc,vimFuncVar,vimOper,vimOperParen,vimNumber,vimString,vimRegister,@vimContinue,vim9Comment,vimVar,vimBoolean,vimNull +syn match vimOper "||\|&&\|[-+*/%.!]" skipwhite nextgroup=vimString,vimSpecFile syn match vimOper "\%#=1\(==\|!=\|>=\|<=\|=\~\|!\~\|>\|<\|=\|!\~#\)[?#]\{0,2}" skipwhite nextgroup=vimString,vimSpecFile syn match vimOper "\(\" skipwhite nextgroup=vimString,vimSpecFile syn region vimOperParen matchgroup=vimParenSep start="(" end=")" contains=@vimOperGroup @@ -246,8 +260,8 @@ syn cluster vimFuncList contains=vimFuncBang,vimFunctionError,vimFuncKey,vimFunc syn cluster vimDefList contains=vimFuncBang,vimFunctionError,vimDefKey,vimFuncSID,Tag syn cluster vimFuncBodyCommon contains=@vimCmdList,vimCmplxRepeat,vimContinue,vimCtrlChar,vimDef,vimEnvvar,vimFBVar,vimFunc,vimFunction,vimLetHereDoc,vimNotation,vimNotFunc,vimNumber,vimOper,vimOperParen,vimRegister,vimSearch,vimSpecFile,vimString,vimSubst,vimFuncFold -syn cluster vimFuncBodyList contains=@vimFuncBodyCommon,vimComment,vimLineComment,vimFuncVar,vimInsert -syn cluster vimDefBodyList contains=@vimFuncBodyCommon,vim9Comment,vim9LineComment +syn cluster vimFuncBodyList contains=@vimFuncBodyCommon,vimComment,vimLineComment,vimFuncVar,vimInsert,vimConst,vimLet +syn cluster vimDefBodyList contains=@vimFuncBodyCommon,vim9Comment,vim9LineComment,vim9Const,vim9Final,vim9Var,vim9Null,vim9Boolean,vim9For syn region vimFuncPattern contained matchgroup=vimOper start="/" end="$" contains=@vimSubstList syn match vimFunction "\" skipwhite nextgroup=vimCmdSep,vimComment,vimFuncPattern contains=vimFuncKey @@ -267,7 +281,7 @@ syn keyword vimFuncKey contained fu[nction] syn keyword vimDefKey contained def syn region vimFuncParams contained matchgroup=Delimiter start="(" skip=+\n\s*\\\|\n\s*"\\ + end=")" skipwhite skipnl nextgroup=vimFuncBody,vimFuncComment,vimEndfunction,vimFuncMod,vim9CommentError contains=vimFuncParam,@vimContinue -syn region vimDefParams contained matchgroup=Delimiter start="(" end=")" skipwhite skipnl nextgroup=vimDefBody,vimDefComment,vimEnddef,vimReturnType,vimCommentError contains=vimDefParam,vim9Comment +syn region vimDefParams contained matchgroup=Delimiter start="(" end=")" skipwhite skipnl nextgroup=vimDefBody,vimDefComment,vimEnddef,vimReturnType,vimCommentError contains=vimDefParam,vim9Comment,vimFuncParamEquals syn match vimFuncParam contained "\<\h\w*\>\|\.\.\." skipwhite nextgroup=vimFuncParamEquals syn match vimDefParam contained "\<\h\w*\>" skipwhite nextgroup=vimParamType,vimFuncParamEquals @@ -291,9 +305,9 @@ syn match vimFuncBlank contained "\s\+" " Types: {{{2 " ===== -" vimTypes : new for vim9 + syn region vimReturnType contained start=":\s" end="$" matchgroup=vim9Comment end="\ze[#"]" skipwhite skipnl nextgroup=vimDefBody,vimDefComment,vimEnddef,vimCommentError contains=vimTypeSep transparent -syn match vimParamType contained ":\s\+\a" skipwhite skipnl nextgroup=vimFuncParamEquals contains=vimTypeSep,@vimType +syn match vimParamType contained ":\s" skipwhite skipnl nextgroup=@vimType contains=vimTypeSep syn match vimTypeSep contained ":\s\@=" skipwhite nextgroup=@vimType syn keyword vimType contained any blob bool channel float job number string void @@ -369,35 +383,23 @@ if get(g:, "vimsyn_comment_strings", 1) endif if s:vim9script - syn match vimComment excludenl +\s"[^\-:.%#=*].*$+lc=1 contains=@vimCommentGroup,vimCommentString contained - syn match vimComment +\" skipwhite nextgroup=vimTypeSep,vimLetHereDoc +syn region vim9VariableList contained start="\[" end="]" contains=vim9Variable,@vimContinue " For: {{{2 " === -syn keyword vimFor for skipwhite nextgroup=vimVar,vimVarList +if s:vim9script + syn keyword vim9For for skipwhite nextgroup=vim9Variable,vim9VariableList +else + syn keyword vimFor for skipwhite nextgroup=vimVar,vimVarList +endif " Abbreviations: {{{2 " ============= @@ -830,13 +842,9 @@ syn match vimCtrlChar "[- -]" " Beginners - Patterns that involve ^ {{{2 " ========= -if s:vim9script - syn region vim9LineComment start=+^[ \t:]*\zs#.*$+ skip=+\n\s*\\\|\n\s*#\\ + end="$" contains=@vimCommentGroup,vimCommentString,vim9CommentTitle - syn region vimLineComment start=+^[ \t:]*\zs".*$+ skip=+\n\s*\\\|\n\s*"\\ + end="$" contains=@vimCommentGroup,vimCommentString,vimCommentTitle contained -else - syn region vimLineComment start=+^[ \t:]*\zs".*$+ skip=+\n\s*\\\|\n\s*"\\ + end="$" contains=@vimCommentGroup,vimCommentString,vimCommentTitle - syn region vim9LineComment start=+^[ \t:]*\zs#.*$+ skip=+\n\s*\\\|\n\s*#\\ + end="$" contains=@vimCommentGroup,vimCommentString,vim9CommentTitle contained -endif +Vim9 syn region vim9LineComment start=+^[ \t:]*\zs#.*$+ skip=+\n\s*\\\|\n\s*#\\ + end="$" contains=@vimCommentGroup,vimCommentString,vim9CommentTitle +VimL syn region vimLineComment start=+^[ \t:]*\zs".*$+ skip=+\n\s*\\\|\n\s*"\\ + end="$" contains=@vimCommentGroup,vimCommentString,vimCommentTitle + syn match vimCommentTitle '"\s*\%([sS]:\|\h\w*#\)\=\u\w*\(\s\+\u\w*\)*:'hs=s+1 contained contains=vimCommentTitleLeader,vimTodo,@vimCommentGroup syn match vim9CommentTitle '#\s*\%([sS]:\|\h\w*#\)\=\u\w*\(\s\+\u\w*\)*:'hs=s+1 contained contains=vim9CommentTitleLeader,vimTodo,@vimCommentGroup @@ -1083,7 +1091,6 @@ if !exists("skip_vim_syntax_inits") hi def link vimBufnrWarn vimWarn endif - hi def link vim9Vim9ScriptArg Special hi def link vimAbb vimCommand hi def link vimAddress vimMark hi def link vimAugroupBang vimBang @@ -1102,11 +1109,8 @@ if !exists("skip_vim_syntax_inits") hi def link vimCommand Statement hi def link vimComment Comment hi def link vimCommentError vimError - hi def link vim9Comment Comment - hi def link vim9CommentError vimError hi def link vimCommentString vimString hi def link vimCommentTitle PreProc - hi def link vim9CommentTitle PreProc hi def link vimCondHL vimCommand hi def link vimConst vimCommand hi def link vimContinue Special @@ -1174,7 +1178,6 @@ if !exists("skip_vim_syntax_inits") hi def link vimLetHereDocStop Special hi def link vimLetRegister Special hi def link vimLineComment vimComment - hi def link vim9LineComment vimComment hi def link vimMapBang vimBang hi def link vimMapModKey vimFuncSID hi def link vimMapMod vimBracket @@ -1219,7 +1222,6 @@ if !exists("skip_vim_syntax_inits") hi def link vimSetMod vimOption hi def link vimSetSep Statement hi def link vimSetString vimString - hi def link vim9Vim9Script vimCommand hi def link vimShebang PreProc hi def link vimSleep vimCommand hi def link vimSleepArg Constant @@ -1281,6 +1283,20 @@ if !exists("skip_vim_syntax_inits") hi def link vimVar Identifier hi def link vimWarn WarningMsg + hi def link vim9Boolean Boolean + hi def link vim9Comment Comment + hi def link vim9CommentError vimError + hi def link vim9CommentTitle PreProc + hi def link vim9Const vimCommand + hi def link vim9Final vimCommand + hi def link vim9For vimCommand + hi def link vim9LineComment vimComment + hi def link vim9Null Constant + hi def link vim9Var vimCommand + hi def link vim9Variable vimVar + hi def link vim9Vim9Script vimCommand + hi def link vim9Vim9ScriptArg Special + hi def link nvimAutoEvent vimAutoEvent hi def link nvimHLGroup vimHLGroup endif @@ -1290,6 +1306,8 @@ let b:current_syntax = "vim" " --------------------------------------------------------------------- " Cleanup: {{{1 +delc Vim9 +delc VimL delc VimFolda delc VimFoldf delc VimFoldh -- cgit From adef830f83a9a861e28ca0def6308a708d7fb731 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 19 Jul 2024 12:16:20 +0800 Subject: vim-patch:99984fc: runtime(vim): Update base-syntax, improve :map highlighting (#29795) Match :map ( RHS properly. Only match ! after :map, :noremap, :unmap and :mapclear. closes: vim/vim#15297 https://github.com/vim/vim/commit/99984fc58abf8dd5dac76c80635a724a94824e69 Co-authored-by: Doug Kearns --- runtime/syntax/vim.vim | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'runtime/syntax/vim.vim') diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index 2d3e8beed5..1c6aa72448 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -177,7 +177,7 @@ syn match vimNumber '\%(^\|\A\)\zs#\x\{6}' skipwhite nextgroup=vimGlobal,vimSub syn case match " All vimCommands are contained by vimIsCommand. {{{2 -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 +syn cluster vimCmdList contains=vimAbb,vimAddress,vimAutoCmd,vimAugroup,vimBehave,vimCall,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 syn cluster vim9CmdList contains=vim9Const,vim9Final,vim9For,vim9Var syn match vimCmdSep "[:|]\+" skipwhite nextgroup=@vimCmdList,vimSubst1 syn match vimIsCommand "\<\%(\h\w*\|[23]mat\%[ch]\)\>" contains=vimCommand @@ -210,6 +210,10 @@ syn match vimBehave "\" nextgroup=vimBehaveBang,vimBehaveModel,vi syn match vimBehaveBang contained "\a\@1<=!" nextgroup=vimBehaveModel skipwhite syn keyword vimBehaveModel contained mswin xterm +" Call {{{2 +" ==== +syn match vimCall "\" skipwhite nextgroup=vimFunc + " Exception Handling {{{2 syn keyword vimThrow th[row] skipwhite nextgroup=@vimExprList syn keyword vimCatch cat[ch] skipwhite nextgroup=vimCatchPattern @@ -568,15 +572,17 @@ syn region vimExecute matchgroup=vimCommand start="\" skip=+\\|\|\ " Maps: {{{2 " ==== -syn match vimMap "\\ze\s*(\@!" skipwhite nextgroup=vimMapMod,vimMapLhs -syn match vimMap "\" skipwhite nextgroup=vimMapBang,vimMapMod,vimMapLhs +syn keyword vimMap no[remap] skipwhite nextgroup=vimMapBang,vimMapMod,vimMapLhs " GEN_SYN_VIM: vimCommand mapclear, START_STR='syn keyword vimMap', END_STR='skipwhite nextgroup=vimMapMod' syn keyword vimMap cmapc[lear] imapc[lear] lmapc[lear] nmapc[lear] omapc[lear] smapc[lear] tmapc[lear] vmapc[lear] xmapc[lear] skipwhite nextgroup=vimMapMod -syn keyword vimMap mapc[lear] skipwhite nextgroup=vimMapBang,vimMapMod -" GEN_SYN_VIM: vimCommand unmap, START_STR='syn keyword vimUnmap', END_STR='skipwhite nextgroup=vimMapBang,vimMapMod,vimMapLhs' -syn keyword vimUnmap cu[nmap] iu[nmap] lu[nmap] nun[map] ou[nmap] sunm[ap] tunma[p] unm[ap] vu[nmap] xu[nmap] skipwhite nextgroup=vimMapBang,vimMapMod,vimMapLhs +syn keyword vimMap mapc[lear] skipwhite nextgroup=vimMapBang,vimMapMod +" GEN_SYN_VIM: vimCommand unmap, START_STR='syn keyword vimUnmap', END_STR='skipwhite nextgroup=vimMapMod,vimMapLhs' +syn keyword vimUnmap cu[nmap] iu[nmap] lu[nmap] nun[map] ou[nmap] sunm[ap] tunma[p] vu[nmap] xu[nmap] skipwhite nextgroup=vimMapMod,vimMapLhs +syn keyword vimUnmap unm[ap] skipwhite nextgroup=vimMapBang,vimMapMod,vimMapLhs + syn match vimMapLhs contained "\%(.\|\S\)\+" contains=vimCtrlChar,vimNotation skipwhite nextgroup=vimMapRhs syn match vimMapLhs contained "\%(.\|\S\)\+\ze\s*$" contains=vimCtrlChar,vimNotation skipwhite skipnl nextgroup=vimMapRhsContinue syn match vimMapBang contained "\a\@1<=!" skipwhite nextgroup=vimMapMod,vimMapLhs @@ -643,6 +649,8 @@ syn match vimFunc "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%(\w\ syn match vimUserFunc contained "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%(\w\+\.\)*\I[a-zA-Z0-9_.]*\)\|\<\u[a-zA-Z0-9.]*\>\|\" contains=vimNotation syn keyword vimFuncEcho contained ec ech echo +syn match vimMap "\\%([(#[]\|\s\+\%([-+*/%]\=\|\.\.\)=\)\@!' @@ -1104,6 +1112,7 @@ if !exists("skip_vim_syntax_inits") hi def link vimBehaveModel vimBehave hi def link vimBehave vimCommand hi def link vimBracket Delimiter + hi def link vimCall vimCommand hi def link vimCatch vimCommand hi def link vimCmplxRepeat SpecialChar hi def link vimCommand Statement -- cgit From 0cdeb06db0062951f2f2d2998510e2fff7e0faee Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 25 Jul 2024 09:55:59 +0800 Subject: vim-patch:ddbb6fe: runtime(vim): Update base-syntax, improve :set highlighting (#29850) - Match bang, "all" and "termcap" options, and trailing command separator "|". - Highlight set assignment operators. - Match multiline :set and multiline option values. - Mention the newer "0o" octal prefix at :help :set=. closes: vim/vim#15329 https://github.com/vim/vim/commit/ddbb6fe2d0344e93436c5602b7a06169f49a9b52 Co-authored-by: Doug Kearns --- runtime/syntax/vim.vim | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'runtime/syntax/vim.vim') diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index 1c6aa72448..8dd72d76e5 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -36,8 +36,8 @@ syn keyword vimOnlyOption contained nobiosk nobioskey noconsk noconskey nocp noc " Invertible setting variants syn keyword vimOnlyOption contained invbiosk invbioskey invconsk invconskey invcp invcompatible invguipty invmacatsui invsn invshortname invta invtextauto invtx invtextmode invtf invttyfast invtbi invttybuiltin invwiv invweirdinvert " termcap codes (which can also be set) {{{2 -" GEN_SYN_VIM: vimOption term output code, START_STR='syn keyword vimOption contained', END_STR='' -syn keyword vimOption contained t_AB t_AF t_AU t_AL t_al t_bc t_BE t_BD t_cd t_ce t_Ce t_CF t_cl t_cm t_Co t_CS t_Cs t_cs t_CV t_da t_db t_DL t_dl t_ds t_Ds t_EC t_EI t_fs t_fd t_fe t_GP t_IE t_IS t_ke t_ks t_le t_mb t_md t_me t_mr t_ms t_nd t_op t_RF t_RB t_RC t_RI t_Ri t_RK t_RS t_RT t_RV t_Sb t_SC t_se t_Sf t_SH t_SI t_Si t_so t_SR t_sr t_ST t_Te t_te t_TE t_ti t_TI t_Ts t_ts t_u7 t_ue t_us t_Us t_ut t_vb t_ve t_vi t_VS t_vs t_WP t_WS t_XM t_xn t_xs t_ZH t_ZR t_8f t_8b t_8u +" GEN_SYN_VIM: vimOption term output code, START_STR='syn keyword vimOption contained', END_STR='skipwhite nextgroup=vimSetEqual,vimSetMod' +syn keyword vimOption contained t_AB t_AF t_AU t_AL t_al t_bc t_BE t_BD t_cd t_ce t_Ce t_CF t_cl t_cm t_Co t_CS t_Cs t_cs t_CV t_da t_db t_DL t_dl t_ds t_Ds t_EC t_EI t_fs t_fd t_fe t_GP t_IE t_IS t_ke t_ks t_le t_mb t_md t_me t_mr t_ms t_nd t_op t_RF t_RB t_RC t_RI t_Ri t_RK t_RS t_RT t_RV t_Sb t_SC t_se t_Sf t_SH t_SI t_Si t_so t_SR t_sr t_ST t_Te t_te t_TE t_ti t_TI t_Ts t_ts t_u7 t_ue t_us t_Us t_ut t_vb t_ve t_vi t_VS t_vs t_WP t_WS t_XM t_xn t_xs t_ZH t_ZR t_8f t_8b t_8u t_xo skipwhite nextgroup=vimSetEqual,vimSetMod " term key codes syn keyword vimOption contained t_F1 t_F2 t_F3 t_F4 t_F5 t_F6 t_F7 t_F8 t_F9 t_k1 t_K1 t_k2 t_k3 t_K3 t_k4 t_K4 t_k5 t_K5 t_k6 t_K6 t_k7 t_K7 t_k8 t_K8 t_k9 t_K9 t_KA t_kb t_kB t_KB t_KC t_kd t_kD t_KD t_KE t_KF t_KG t_kh t_KH t_kI t_KI t_KJ t_KK t_kl t_KL t_kN t_kP t_kr t_ku syn match vimTermOption contained "t_%1" @@ -497,11 +497,15 @@ syn match vimCmplxRepeat '[^a-zA-Z_/\\()]q[0-9a-zA-Z"]\>'lc=1 syn match vimCmplxRepeat '@[0-9a-z".=@:]\ze\($\|[^a-zA-Z]\>\)' " Set command and associated set-options (vimOptions) with comment {{{2 -syn region vimSet matchgroup=vimCommand start="\<\%(setl\%[ocal]\|setg\%[lobal]\|se\%[t]\)\>" skip="\%(\\\\\)*\\.\n\@!" end="$" end="|" matchgroup=vimNotation end="<[cC][rR]>" keepend contains=vimSetEqual,vimOption,vimErrSetting,@vimComment,vimSetString,vimSetMod -syn region vimSetEqual contained start="[=:]\|[-+^]=" skip="\\\\\|\\\s" end="[| \t]"me=e-1 end="$" contains=vimCtrlChar,vimSetSep,vimNotation,vimEnvvar -syn region vimSetString contained start=+="+hs=s+1 skip=+\\\\\|\\"+ end=+"+ contains=vimCtrlChar +syn match vimSet "\<\%(setl\%[ocal]\|setg\%[lobal]\|se\%[t]\)\>" skipwhite nextgroup=vimSetBang,vimSetRegion +syn region vimSetRegion contained start="\S" skip=+\\\\\|\\|\|\n\s*\\\|\n\s*["#]\\ + matchgroup=vimCmdSep end="|" end="$" matchgroup=vimNotation end="<[cC][rR]>" keepend contains=@vimComment,@vimContinue,vimErrSetting,vimOption,vimSetAll,vimSetTermcap +syn region vimSetEqual contained matchgroup=vimOper start="[=:]\|[-+^]=" skip=+\\\\\|\\|\|\\\s\|\n\s*\\\|\n\s*["#]\\ \|^\s*\\\|^\s*["#]\\ + matchgroup=vimCmdSep end="|" end="\ze\s" end="$" contains=@vimContinue,vimCtrlChar,vimEnvvar,vimNotation,vimSetSep +syn match vimSetBang contained "\a\@1<=!" skipwhite nextgroup=vimSetAll,vimSetTermcap +syn keyword vimSetAll contained all nextgroup=vimSetMod +syn keyword vimSetTermcap contained termcap +syn region vimSetString contained start=+="+hs=s+1 skip=+\\\\\|\\"+ end=+"+ contains=vimCtrlChar syn match vimSetSep contained "[,:]" -syn match vimSetMod contained "&vim\=\|[!&?<]\|all&" +syn match vimSetMod contained "\a\@1<=\%(&vim\=\|[!&?<]\)" " Variable Declarations: {{{2 " ===================== @@ -1228,9 +1232,13 @@ if !exists("skip_vim_syntax_inits") hi def link vimSearchDelim Statement hi def link vimSearch vimString hi def link vimSep Delimiter + hi def link vimSet vimCommand + hi def link vimSetAll vimOption + hi def link vimSetBang vimBang hi def link vimSetMod vimOption - hi def link vimSetSep Statement + hi def link vimSetSep vimSep hi def link vimSetString vimString + hi def link vimSetTermcap vimOption hi def link vimShebang PreProc hi def link vimSleep vimCommand hi def link vimSleepArg Constant -- cgit From 172cc23d88585dd7520726c2ebbba4ed7639e348 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 17 Aug 2024 07:09:39 +0800 Subject: vim-patch:d164f2a: runtime(vim): Update base-syntax, improve :let-heredoc highlighting (#30069) The end marker must appear on line of its own without any trailing whitespace. Whitespace is incorrectly allowed before all end markers. Limiting this only to heredocs where "trim" was specified, and with the correct indent, is currently an intractable problem given that contained syntax groups (in this case :let) cannot be limited to start patterns. Highlight interpolated expressions when "eval" is specified. cloess: vim/vim#15511 https://github.com/vim/vim/commit/d164f2a521f8e52e587727657fb1c19e9a25f32a Co-authored-by: Doug Kearns --- runtime/syntax/vim.vim | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'runtime/syntax/vim.vim') diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index 8dd72d76e5..57516dfa61 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -433,11 +433,12 @@ syn match vimEscape contained "\\\o\{1,3}\|\\[xX]\x\{1,2}\|\\u\x\{1,4}\|\\U\x\{1 syn match vimEscape contained "\\<" contains=vimNotation syn match vimEscape contained "\\<\*[^>]*>\=>" -syn region vimString oneline start=+$'+ skip=+''+ end=+'+ contains=vimStringInterpolationBrace,vimStringInterpolationExpr -syn region vimString oneline start=+$"+ end=+"+ contains=@vimStringGroup,vimStringInterpolationBrace,vimStringInterpolationExpr +syn region vimString oneline start=+$'+ skip=+''+ end=+'+ contains=@vimStringInterpolation +syn region vimString oneline start=+$"+ end=+"+ contains=@vimStringGroup,@vimStringInterpolation syn region vimStringInterpolationExpr oneline contained matchgroup=vimSep start=+{+ end=+}+ contains=@vimExprList syn match vimStringInterpolationBrace contained "{{" syn match vimStringInterpolationBrace contained "}}" +syn cluster vimStringInterpolation contains=vimStringInterpolationExpr,vimStringInterpolationBrace " Substitutions: {{{2 " ============= @@ -517,7 +518,13 @@ VimL syn keyword vimUnlet unl[et] skipwhite nextgroup=vimUnletBang,vimUnletVars syn match vimUnletBang contained "!" skipwhite nextgroup=vimUnletVars syn region vimUnletVars contained start="$\I\|\h" skip="\n\s*\\" end="$" end="|" contains=vimVar,vimEnvvar,vimContinue,vimString,vimNumber -VimFoldh syn region vimLetHereDoc matchgroup=vimLetHereDocStart start='=<<\s*\%(trim\s\+\%(eval\s\+\)\=\|eval\s\+\%(trim\s\+\)\=\)\=\z(\L\S*\)' matchgroup=vimLetHereDocStop end='^\s*\z1\s*$' extend +" Note: This incorrectly matches end markers with leading whitespace even if +" "trim" was not specified. Matching :let indent for "trim" indented +" end markers would require a contained :let that cannot be restricted +" to the start pattern. A common internal testing use of heredocs is to +" specify code blocks where :let commonly appears in the heredoc text. +VimFoldh syn region vimLetHereDoc matchgroup=vimLetHereDocStart start='=<<\s*\%(trim\s\+\)\=\z(\L\S*\)' matchgroup=vimLetHereDocStop end='^\s*\z1$' extend +VimFoldh syn region vimLetHereDoc matchgroup=vimLetHereDocStart start='=<<\s*\%(\%(trim\s\+\)\=eval\s\+\|eval\s\+\%(trim\s\+\)\=\)\z(\L\S*\)' matchgroup=vimLetHereDocStop end='^\s*\z1$' contains=@vimStringInterpolation extend Vim9 syn keyword vim9Const const skipwhite nextgroup=vim9Variable,vim9VariableList Vim9 syn keyword vim9Final final skipwhite nextgroup=vim9Variable,vim9VariableList -- cgit From 6af9ca4926e05ac698d828ab6aeef2f45ccccdf8 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 23 Aug 2024 09:56:29 +0800 Subject: vim-patch:95e9078: runtime(vim): Improve heredoc handling for all embedded scripts (#30121) * Improve heredoc handling - Support "trim" for all the embedded scripts. - Check the indent of "trim" for "let" and all the embedded scripts. * Update missing part of vim.vim.base in the commit d164f2a521f8e52e587727657fb1c19e9a25f32a. * Update gen_syntax_vim.vim to catch up with 9.1.0685's source code. closes: vim/vim#15542 https://github.com/vim/vim/commit/95e90781a4c92b7b061213cfa38b35bdbf719cc1 Co-authored-by: Ken Takata --- runtime/syntax/vim.vim | 95 +++++++++++++++++++++++++++++++------------------- 1 file changed, 59 insertions(+), 36 deletions(-) (limited to 'runtime/syntax/vim.vim') diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index 57516dfa61..0df36eaee2 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -371,7 +371,7 @@ endif syn case ignore syn keyword vimUserAttrbKey contained bar ban[g] cou[nt] ra[nge] com[plete] n[args] re[gister] " GEN_SYN_VIM: vimUserAttrbCmplt, START_STR='syn keyword vimUserAttrbCmplt contained', END_STR='' -syn keyword vimUserAttrbCmplt contained arglist augroup behave buffer color command compiler cscope diff_buffer dir environment event expression file file_in_path filetype function help highlight history keymap locale mapclear mapping menu messages syntax syntime option packadd runtime shellcmd sign tag tag_listfiles user var breakpoint scriptnames dir_in_path +syn keyword vimUserAttrbCmplt contained arglist augroup behave breakpoint buffer color command compiler cscope diff_buffer dir dir_in_path environment event expression file file_in_path filetype function help highlight history keymap locale mapclear mapping menu messages option packadd runtime scriptnames shellcmd sign syntax syntime tag tag_listfiles user var syn keyword vimUserAttrbCmplt contained custom customlist nextgroup=vimUserAttrbCmpltFunc,vimUserCmdError syn match vimUserAttrbCmpltFunc contained ",\%([sS]:\|<[sS][iI][dD]>\)\=\%(\h\w*\%([.#]\h\w*\)\+\|\h\w*\)"hs=s+1 nextgroup=vimUserCmdError @@ -518,13 +518,10 @@ VimL syn keyword vimUnlet unl[et] skipwhite nextgroup=vimUnletBang,vimUnletVars syn match vimUnletBang contained "!" skipwhite nextgroup=vimUnletVars syn region vimUnletVars contained start="$\I\|\h" skip="\n\s*\\" end="$" end="|" contains=vimVar,vimEnvvar,vimContinue,vimString,vimNumber -" Note: This incorrectly matches end markers with leading whitespace even if -" "trim" was not specified. Matching :let indent for "trim" indented -" end markers would require a contained :let that cannot be restricted -" to the start pattern. A common internal testing use of heredocs is to -" specify code blocks where :let commonly appears in the heredoc text. -VimFoldh syn region vimLetHereDoc matchgroup=vimLetHereDocStart start='=<<\s*\%(trim\s\+\)\=\z(\L\S*\)' matchgroup=vimLetHereDocStop end='^\s*\z1$' extend -VimFoldh syn region vimLetHereDoc matchgroup=vimLetHereDocStart start='=<<\s*\%(\%(trim\s\+\)\=eval\s\+\|eval\s\+\%(trim\s\+\)\=\)\z(\L\S*\)' matchgroup=vimLetHereDocStop end='^\s*\z1$' contains=@vimStringInterpolation exte