diff options
Diffstat (limited to 'runtime/syntax/vim.vim')
-rw-r--r-- | runtime/syntax/vim.vim | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index 72a0d215ad..ccbc20aa63 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -13,6 +13,7 @@ " 2024 Jan 23 by Vim Project (add :[23]match commands) " 2024 Jan 25 by Vim Project (WinNewPre autocommand) " 2024 Jan 27 by Vim Project (add foreach() function) +" 2024 Jan 28 by Vim Project (improve line-continuation matching) " Version: 9.0-25 " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_VIM " Automatically generated keyword lists: {{{1 @@ -247,7 +248,7 @@ syn keyword vimAugroupKey contained aug[roup] " Operators: {{{2 " ========= -syn cluster vimOperGroup contains=vimEnvvar,vimFunc,vimFuncVar,vimOper,vimOperParen,vimNumber,vimString,vimType,vimRegister,vimContinue,vim9Comment,vimVar +syn cluster vimOperGroup contains=vimEnvvar,vimFunc,vimFuncVar,vimOper,vimOperParen,vimNumber,vimString,vimType,vimRegister,@vimContinue,vim9Comment,vimVar syn match vimOper "||\|&&\|[-+*/%.!]" skipwhite nextgroup=vimString,vimSpecFile syn match vimOper "\%#=1\(==\|!=\|>=\|<=\|=\~\|!\~\|>\|<\|=\|!\~#\)[?#]\{0,2}" skipwhite nextgroup=vimString,vimSpecFile syn match vimOper "\(\<is\|\<isnot\)[?#]\{0,2}\>" skipwhite nextgroup=vimString,vimSpecFile @@ -535,23 +536,23 @@ syn match vimNormCmds contained ".*$" " Syntax: {{{2 "======= -syn match vimGroupList contained "@\=[^[:space:],]\+" nextgroup=vimGroupListComma skipwhite skipnl -syn match vimGroupListContinue contained "\\" nextgroup=vimGroupList skipwhite -syn match vimGroupListComma contained "," nextgroup=vimGroupList,vimGroupListContinue skipwhite skipnl -syn keyword vimGroupSpecial contained ALL ALLBUT CONTAINED TOP +syn match vimGroupList contained "[^[:space:],]\+\%(\s*,\s*[^[:space:],]\+\)*" contains=vimGroupSpecial +syn region vimGroupList contained start=/^\s*["#]\\ \|^\s*\\\|[^[:space:],]\+\s*,/ skip=/\s*\n\s*\\\|\s*\n\s*["#]\\ \|^\s*\\\|^\s*["#]\\ / end=/[^[:space:],]\s*$\|[^[:space:],]\ze\s\+\w/ contains=@vimContinue,vimGroupSpecial +syn keyword vimGroupSpecial contained ALL ALLBUT CONTAINED TOP + if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_novimsynerror") syn match vimSynError contained "\i\+" syn match vimSynError contained "\i\+=" nextgroup=vimGroupList endif -syn match vimSynContains contained "\<contain\(s\|edin\)=" nextgroup=vimGroupList,vimGroupListContinue skipwhite skipnl -syn match vimSynKeyContainedin contained "\<containedin=" nextgroup=vimGroupList -syn match vimSynNextgroup contained "nextgroup=" nextgroup=vimGroupList,vimGroupListContinue skipwhite skipnl +syn match vimSynContains contained "\<contain\%(s\|edin\)=" skipwhite skipnl nextgroup=vimGroupList +syn match vimSynKeyContainedin contained "\<containedin=" skipwhite skipnl nextgroup=vimGroupList +syn match vimSynNextgroup contained "\<nextgroup=" skipwhite skipnl nextgroup=vimGroupList if has("conceal") + " no whitespace allowed after '=' syn match vimSynCchar contained "\<cchar=" nextgroup=vimSynCcharValue syn match vimSynCcharValue contained "\S" endif - syn match vimSyntax "\<sy\%[ntax]\>" contains=vimCommand skipwhite nextgroup=vimSynType,vimComment,vim9Comment syn match vimAuSyntax contained "\s+sy\%[ntax]" contains=vimCommand skipwhite nextgroup=vimSynType,vimComment,vim9Comment syn cluster vimFuncBodyList add=vimSyntax @@ -568,9 +569,9 @@ syn keyword vimSynType contained clear skipwhite nextgroup=vimGroupList " Syntax: cluster {{{2 syn keyword vimSynType contained cluster skipwhite nextgroup=vimClusterName -syn region vimClusterName contained matchgroup=vimGroupName start="\h\w*" skip="\\\\\|\\\|\n\s*\\" matchgroup=vimSep end="$\||" contains=vimContinue,vimGroupAdd,vimGroupRem,vimSynContains,vimSynError -syn match vimGroupAdd contained "add=" nextgroup=vimGroupList -syn match vimGroupRem contained "remove=" nextgroup=vimGroupList +syn region vimClusterName contained keepend matchgroup=vimGroupName start="\h\w*\>" skip=+\\\\\|\\\|\n\s*\\\|\n\s*"\\ + matchgroup=vimCmdSep end="$\||" contains=@vimContinue,vimGroupAdd,vimGroupRem,vimSynContains,vimSynError +syn match vimGroupAdd contained keepend "\<add=" skipwhite skipnl nextgroup=vimGroupList +syn match vimGroupRem contained keepend "\<remove=" skipwhite skipnl nextgroup=vimGroupList syn cluster vimFuncBodyList add=vimSynType,vimGroupAdd,vimGroupRem " Syntax: foldlevel {{{2 @@ -590,16 +591,16 @@ syn keyword vimSynType contained include skipwhite nextgroup=vimGroupList syn cluster vimFuncBodyList add=vimSynType " Syntax: keyword {{{2 -syn cluster vimSynKeyGroup contains=vimContinue,vimSynCchar,vimSynNextgroup,vimSynKeyOpt,vimSynKeyContainedin +syn cluster vimSynKeyGroup contains=@vimContinue,vimSynCchar,vimSynNextgroup,vimSynKeyOpt,vimSynKeyContainedin syn keyword vimSynType contained keyword skipwhite nextgroup=vimSynKeyRegion -syn region vimSynKeyRegion contained keepend matchgroup=vimGroupName start="\h\w*" skip="\\\\\|\\|\|\n\s*\\" matchgroup=vimSep end="|\|$" contains=@vimSynKeyGroup +syn region vimSynKeyRegion contained keepend matchgroup=vimGroupName start="\h\w*\>" skip=+\\\\\|\\|\|\n\s*\\\|\n\s*"\\ + matchgroup=vimCmdSep end="|\|$" contains=@vimSynKeyGroup syn match vimSynKeyOpt contained "\%#=1\<\(conceal\|contained\|transparent\|skipempty\|skipwhite\|skipnl\)\>" syn cluster vimFuncBodyList add=vimSynType " Syntax: match {{{2 -syn cluster vimSynMtchGroup contains=vimContinue,vimMtchComment,vimSynCchar,vimSynContains,vimSynError,vimSynMtchOpt,vimSynNextgroup,vimSynRegPat,vimNotation,vim9Comment +syn cluster vimSynMtchGroup contains=@vimContinue,vimSynCchar,vimSynContains,vimSynError,vimSynMtchOpt,vimSynNextgroup,vimSynRegPat,vimNotation,vimMtchComment syn keyword vimSynType contained match skipwhite nextgroup=vimSynMatchRegion -syn region vimSynMatchRegion contained keepend matchgroup=vimGroupName start="\h\w*" skip="\n\s*\\" matchgroup=vimSep end="|\|$" contains=@vimSynMtchGroup +syn region vimSynMatchRegion contained keepend matchgroup=vimGroupName start="\h\w*\>" skip=+\\\\\|\\|\|\n\s*\\\|\n\s*"\\ + matchgroup=vimCmdSep end="|\|$" contains=@vimSynMtchGroup syn match vimSynMtchOpt contained "\%#=1\<\(conceal\|transparent\|contained\|excludenl\|keepend\|skipempty\|skipwhite\|display\|extend\|skipnl\|fold\)\>" syn cluster vimFuncBodyList add=vimSynMtchGroup @@ -607,14 +608,14 @@ syn cluster vimFuncBodyList add=vimSynMtchGroup syn keyword vimSynType contained enable list manual off on reset " Syntax: region {{{2 -syn cluster vimSynRegPatGroup contains=vimPatSep,vimNotPatSep,vimSynPatRange,vimSynNotPatRange,vimSubstSubstr,vimPatRegion,vimPatSepErr,vimNotation -syn cluster vimSynRegGroup contains=vimContinue,vimSynCchar,vimSynContains,vimSynNextgroup,vimSynRegOpt,vimSynReg,vimSynMtchGrp +syn cluster vimSynRegPatGroup contains=@vimContinue,vimPatSep,vimNotPatSep,vimSynPatRange,vimSynNotPatRange,vimSubstSubstr,vimPatRegion,vimPatSepErr,vimNotation +syn cluster vimSynRegGroup contains=@vimContinue,vimSynCchar,vimSynContains,vimSynNextgroup,vimSynRegOpt,vimSynReg,vimSynMtchGrp syn keyword vimSynType contained region skipwhite nextgroup=vimSynRegion -syn region vimSynRegion contained keepend matchgroup=vimGroupName start="\h\w*" skip="\\\\\|\\\|\n\s*\\" end="|\|$" contains=@vimSynRegGroup +syn region vimSynRegion contained keepend matchgroup=vimGroupName start="\h\w*" skip=+\\\\\|\\\|\n\s*\\\|\n\s*"\\ + end="|\|$" contains=@vimSynRegGroup syn match vimSynRegOpt contained "\%#=1\<\(conceal\(ends\)\=\|transparent\|contained\|excludenl\|skipempty\|skipwhite\|display\|keepend\|oneline\|extend\|skipnl\|fold\)\>" -syn match vimSynReg contained "\(start\|skip\|end\)="he=e-1 nextgroup=vimSynRegPat +syn match vimSynReg contained "\<\%(start\|skip\|end\)=" nextgroup=vimSynRegPat syn match vimSynMtchGrp contained "matchgroup=" nextgroup=vimGroup,vimHLGroup -syn region vimSynRegPat contained extend start="\z([-`~!@#$%^&*_=+;:'",./?]\)" skip="\\\\\|\\\z1\|\n\s*\\" end="\z1" contains=@vimSynRegPatGroup skipwhite nextgroup=vimSynPatMod,vimSynReg +syn region vimSynRegPat contained extend start="\z([-`~!@#$%^&*_=+;:'",./?]\)" skip=/\\\\\|\\\z1\|\n\s*\\\|\n\s*"\\ / end="\z1" contains=@vimSynRegPatGroup skipwhite nextgroup=vimSynPatMod,vimSynReg syn match vimSynPatMod contained "\%#=1\(hs\|ms\|me\|hs\|he\|rs\|re\)=[se]\([-+]\d\+\)\=" syn match vimSynPatMod contained "\%#=1\(hs\|ms\|me\|hs\|he\|rs\|re\)=[se]\([-+]\d\+\)\=," nextgroup=vimSynPatMod syn match vimSynPatMod contained "lc=\d\+" @@ -708,7 +709,9 @@ syn match vimLineComment +^[ \t:]*"\("[^"]*"\|[^"]\)*$+ contains=@vimCommentGrou syn match vim9LineComment +^[ \t:]\+#.*$+ contains=@vimCommentGroup,vimCommentString,vimCommentTitle syn match vimCommentTitle '"\s*\%([sS]:\|\h\w*#\)\=\u\w*\(\s\+\u\w*\)*:'hs=s+1 contained contains=vimCommentTitleLeader,vimTodo,@vimCommentGroup " Note: Look-behind to work around nextgroup skipnl consuming leading whitespace and preventing a match -syn match vimContinue "\%(^\s*\)\@32<=\\" +syn match vimContinue "^\s*\zs\\" +syn match vimContinueComment '^\s*\zs["#]\\ .*' contained +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 @@ -948,6 +951,7 @@ if !exists("skip_vim_syntax_inits") hi def link vimCondHL vimCommand hi def link vimConst vimCommand hi def link vimContinue Special + hi def link vimContinueComment vimComment hi def link vimCtrlChar SpecialChar hi def link vimEchoHLNone vimGroup hi def link vimEchoHL vimCommand @@ -970,7 +974,6 @@ if !exists("skip_vim_syntax_inits") hi def link vimFuncSID Special hi def link vimFuncVar Identifier hi def link vimGroupAdd vimSynOption - hi def link vimGroupListContinue vimContinue hi def link vimGroupName vimGroup hi def link vimGroupRem vimSynOption hi def link vimGroupSpecial Special |