Mercurial > vim
comparison runtime/syntax/vim.vim @ 34227:60e1e94a1b0e
runtime(vim): Update syntax and ftplugin files (#13924)
Commit: https://github.com/vim/vim/commit/21ce159e05615fd139c564b734a4bffc9f3fdc4b
Author: dkearns <dougkearns@gmail.com>
Date: Mon Jan 29 04:54:08 2024 +1100
runtime(vim): Update syntax and ftplugin files (https://github.com/vim/vim/issues/13924)
Improve matching of line-continuations and interspersed comments.
These are now also matched in multiline syntax command patterns,
dictionary literals, and parenthesised expressions and argument lists.
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 28 Jan 2024 19:00:08 +0100 |
parents | 753702283749 |
children | 734467c89330 |
comparison
equal
deleted
inserted
replaced
34226:aced7e335fea | 34227:60e1e94a1b0e |
---|---|
11 " 2024 Jan 14 by Vim Project (TermResponseAll autocommand) | 11 " 2024 Jan 14 by Vim Project (TermResponseAll autocommand) |
12 " 2024 Jan 15 by Vim Project (:hi ctermfont attribute) | 12 " 2024 Jan 15 by Vim Project (:hi ctermfont attribute) |
13 " 2024 Jan 23 by Vim Project (add :[23]match commands) | 13 " 2024 Jan 23 by Vim Project (add :[23]match commands) |
14 " 2024 Jan 25 by Vim Project (WinNewPre autocommand) | 14 " 2024 Jan 25 by Vim Project (WinNewPre autocommand) |
15 " 2024 Jan 27 by Vim Project (add foreach() function) | 15 " 2024 Jan 27 by Vim Project (add foreach() function) |
16 " 2024 Jan 28 by Vim Project (improve line-continuation matching) | |
16 " Version: 9.0-25 | 17 " Version: 9.0-25 |
17 " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_VIM | 18 " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_VIM |
18 " Automatically generated keyword lists: {{{1 | 19 " Automatically generated keyword lists: {{{1 |
19 | 20 |
20 " Quit when a syntax file was already loaded {{{2 | 21 " Quit when a syntax file was already loaded {{{2 |
245 endif | 246 endif |
246 syn keyword vimAugroupKey contained aug[roup] | 247 syn keyword vimAugroupKey contained aug[roup] |
247 | 248 |
248 " Operators: {{{2 | 249 " Operators: {{{2 |
249 " ========= | 250 " ========= |
250 syn cluster vimOperGroup contains=vimEnvvar,vimFunc,vimFuncVar,vimOper,vimOperParen,vimNumber,vimString,vimType,vimRegister,vimContinue,vim9Comment,vimVar | 251 syn cluster vimOperGroup contains=vimEnvvar,vimFunc,vimFuncVar,vimOper,vimOperParen,vimNumber,vimString,vimType,vimRegister,@vimContinue,vim9Comment,vimVar |
251 syn match vimOper "||\|&&\|[-+*/%.!]" skipwhite nextgroup=vimString,vimSpecFile | 252 syn match vimOper "||\|&&\|[-+*/%.!]" skipwhite nextgroup=vimString,vimSpecFile |
252 syn match vimOper "\%#=1\(==\|!=\|>=\|<=\|=\~\|!\~\|>\|<\|=\|!\~#\)[?#]\{0,2}" skipwhite nextgroup=vimString,vimSpecFile | 253 syn match vimOper "\%#=1\(==\|!=\|>=\|<=\|=\~\|!\~\|>\|<\|=\|!\~#\)[?#]\{0,2}" skipwhite nextgroup=vimString,vimSpecFile |
253 syn match vimOper "\(\<is\|\<isnot\)[?#]\{0,2}\>" skipwhite nextgroup=vimString,vimSpecFile | 254 syn match vimOper "\(\<is\|\<isnot\)[?#]\{0,2}\>" skipwhite nextgroup=vimString,vimSpecFile |
254 syn region vimOperParen matchgroup=vimParenSep start="(" end=")" contains=vimoperStar,@vimOperGroup | 255 syn region vimOperParen matchgroup=vimParenSep start="(" end=")" contains=vimoperStar,@vimOperGroup |
255 syn region vimOperParen matchgroup=vimSep start="#\={" end="}" contains=@vimOperGroup nextgroup=vimVar,vimFuncVar | 256 syn region vimOperParen matchgroup=vimSep start="#\={" end="}" contains=@vimOperGroup nextgroup=vimVar,vimFuncVar |
533 syn match vimNorm "\<norm\%[al]!\=" skipwhite nextgroup=vimNormCmds | 534 syn match vimNorm "\<norm\%[al]!\=" skipwhite nextgroup=vimNormCmds |
534 syn match vimNormCmds contained ".*$" | 535 syn match vimNormCmds contained ".*$" |
535 | 536 |
536 " Syntax: {{{2 | 537 " Syntax: {{{2 |
537 "======= | 538 "======= |
538 syn match vimGroupList contained "@\=[^[:space:],]\+" nextgroup=vimGroupListComma skipwhite skipnl | 539 syn match vimGroupList contained "[^[:space:],]\+\%(\s*,\s*[^[:space:],]\+\)*" contains=vimGroupSpecial |
539 syn match vimGroupListContinue contained "\\" nextgroup=vimGroupList skipwhite | 540 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 |
540 syn match vimGroupListComma contained "," nextgroup=vimGroupList,vimGroupListContinue skipwhite skipnl | 541 syn keyword vimGroupSpecial contained ALL ALLBUT CONTAINED TOP |
541 syn keyword vimGroupSpecial contained ALL ALLBUT CONTAINED TOP | 542 |
542 if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_novimsynerror") | 543 if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_novimsynerror") |
543 syn match vimSynError contained "\i\+" | 544 syn match vimSynError contained "\i\+" |
544 syn match vimSynError contained "\i\+=" nextgroup=vimGroupList | 545 syn match vimSynError contained "\i\+=" nextgroup=vimGroupList |
545 endif | 546 endif |
546 syn match vimSynContains contained "\<contain\(s\|edin\)=" nextgroup=vimGroupList,vimGroupListContinue skipwhite skipnl | 547 syn match vimSynContains contained "\<contain\%(s\|edin\)=" skipwhite skipnl nextgroup=vimGroupList |
547 syn match vimSynKeyContainedin contained "\<containedin=" nextgroup=vimGroupList | 548 syn match vimSynKeyContainedin contained "\<containedin=" skipwhite skipnl nextgroup=vimGroupList |
548 syn match vimSynNextgroup contained "nextgroup=" nextgroup=vimGroupList,vimGroupListContinue skipwhite skipnl | 549 syn match vimSynNextgroup contained "\<nextgroup=" skipwhite skipnl nextgroup=vimGroupList |
549 if has("conceal") | 550 if has("conceal") |
551 " no whitespace allowed after '=' | |
550 syn match vimSynCchar contained "\<cchar=" nextgroup=vimSynCcharValue | 552 syn match vimSynCchar contained "\<cchar=" nextgroup=vimSynCcharValue |
551 syn match vimSynCcharValue contained "\S" | 553 syn match vimSynCcharValue contained "\S" |
552 endif | 554 endif |
553 | |
554 | 555 |
555 syn match vimSyntax "\<sy\%[ntax]\>" contains=vimCommand skipwhite nextgroup=vimSynType,vimComment,vim9Comment | 556 syn match vimSyntax "\<sy\%[ntax]\>" contains=vimCommand skipwhite nextgroup=vimSynType,vimComment,vim9Comment |
556 syn match vimAuSyntax contained "\s+sy\%[ntax]" contains=vimCommand skipwhite nextgroup=vimSynType,vimComment,vim9Comment | 557 syn match vimAuSyntax contained "\s+sy\%[ntax]" contains=vimCommand skipwhite nextgroup=vimSynType,vimComment,vim9Comment |
557 syn cluster vimFuncBodyList add=vimSyntax | 558 syn cluster vimFuncBodyList add=vimSyntax |
558 | 559 |
566 " Syntax: clear {{{2 | 567 " Syntax: clear {{{2 |
567 syn keyword vimSynType contained clear skipwhite nextgroup=vimGroupList | 568 syn keyword vimSynType contained clear skipwhite nextgroup=vimGroupList |
568 | 569 |
569 " Syntax: cluster {{{2 | 570 " Syntax: cluster {{{2 |
570 syn keyword vimSynType contained cluster skipwhite nextgroup=vimClusterName | 571 syn keyword vimSynType contained cluster skipwhite nextgroup=vimClusterName |
571 syn region vimClusterName contained matchgroup=vimGroupName start="\h\w*" skip="\\\\\|\\\|\n\s*\\" matchgroup=vimSep end="$\||" contains=vimContinue,vimGroupAdd,vimGroupRem,vimSynContains,vimSynError | 572 syn region vimClusterName contained keepend matchgroup=vimGroupName start="\h\w*\>" skip=+\\\\\|\\\|\n\s*\\\|\n\s*"\\ + matchgroup=vimCmdSep end="$\||" contains=@vimContinue,vimGroupAdd,vimGroupRem,vimSynContains,vimSynError |
572 syn match vimGroupAdd contained "add=" nextgroup=vimGroupList | 573 syn match vimGroupAdd contained keepend "\<add=" skipwhite skipnl nextgroup=vimGroupList |
573 syn match vimGroupRem contained "remove=" nextgroup=vimGroupList | 574 syn match vimGroupRem contained keepend "\<remove=" skipwhite skipnl nextgroup=vimGroupList |
574 syn cluster vimFuncBodyList add=vimSynType,vimGroupAdd,vimGroupRem | 575 syn cluster vimFuncBodyList add=vimSynType,vimGroupAdd,vimGroupRem |
575 | 576 |
576 " Syntax: foldlevel {{{2 | 577 " Syntax: foldlevel {{{2 |
577 syn keyword vimSynType contained foldlevel skipwhite nextgroup=vimSynFoldMethod,vimSynFoldMethodError | 578 syn keyword vimSynType contained foldlevel skipwhite nextgroup=vimSynFoldMethod,vimSynFoldMethodError |
578 if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_novimsynfoldmethoderror") | 579 if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_novimsynfoldmethoderror") |
588 " Syntax: include {{{2 | 589 " Syntax: include {{{2 |
589 syn keyword vimSynType contained include skipwhite nextgroup=vimGroupList | 590 syn keyword vimSynType contained include skipwhite nextgroup=vimGroupList |
590 syn cluster vimFuncBodyList add=vimSynType | 591 syn cluster vimFuncBodyList add=vimSynType |
591 | 592 |
592 " Syntax: keyword {{{2 | 593 " Syntax: keyword {{{2 |
593 syn cluster vimSynKeyGroup contains=vimContinue,vimSynCchar,vimSynNextgroup,vimSynKeyOpt,vimSynKeyContainedin | 594 syn cluster vimSynKeyGroup contains=@vimContinue,vimSynCchar,vimSynNextgroup,vimSynKeyOpt,vimSynKeyContainedin |
594 syn keyword vimSynType contained keyword skipwhite nextgroup=vimSynKeyRegion | 595 syn keyword vimSynType contained keyword skipwhite nextgroup=vimSynKeyRegion |
595 syn region vimSynKeyRegion contained keepend matchgroup=vimGroupName start="\h\w*" skip="\\\\\|\\|\|\n\s*\\" matchgroup=vimSep end="|\|$" contains=@vimSynKeyGroup | 596 syn region vimSynKeyRegion contained keepend matchgroup=vimGroupName start="\h\w*\>" skip=+\\\\\|\\|\|\n\s*\\\|\n\s*"\\ + matchgroup=vimCmdSep end="|\|$" contains=@vimSynKeyGroup |
596 syn match vimSynKeyOpt contained "\%#=1\<\(conceal\|contained\|transparent\|skipempty\|skipwhite\|skipnl\)\>" | 597 syn match vimSynKeyOpt contained "\%#=1\<\(conceal\|contained\|transparent\|skipempty\|skipwhite\|skipnl\)\>" |
597 syn cluster vimFuncBodyList add=vimSynType | 598 syn cluster vimFuncBodyList add=vimSynType |
598 | 599 |
599 " Syntax: match {{{2 | 600 " Syntax: match {{{2 |
600 syn cluster vimSynMtchGroup contains=vimContinue,vimMtchComment,vimSynCchar,vimSynContains,vimSynError,vimSynMtchOpt,vimSynNextgroup,vimSynRegPat,vimNotation,vim9Comment | 601 syn cluster vimSynMtchGroup contains=@vimContinue,vimSynCchar,vimSynContains,vimSynError,vimSynMtchOpt,vimSynNextgroup,vimSynRegPat,vimNotation,vimMtchComment |
601 syn keyword vimSynType contained match skipwhite nextgroup=vimSynMatchRegion | 602 syn keyword vimSynType contained match skipwhite nextgroup=vimSynMatchRegion |
602 syn region vimSynMatchRegion contained keepend matchgroup=vimGroupName start="\h\w*" skip="\n\s*\\" matchgroup=vimSep end="|\|$" contains=@vimSynMtchGroup | 603 syn region vimSynMatchRegion contained keepend matchgroup=vimGroupName start="\h\w*\>" skip=+\\\\\|\\|\|\n\s*\\\|\n\s*"\\ + matchgroup=vimCmdSep end="|\|$" contains=@vimSynMtchGroup |
603 syn match vimSynMtchOpt contained "\%#=1\<\(conceal\|transparent\|contained\|excludenl\|keepend\|skipempty\|skipwhite\|display\|extend\|skipnl\|fold\)\>" | 604 syn match vimSynMtchOpt contained "\%#=1\<\(conceal\|transparent\|contained\|excludenl\|keepend\|skipempty\|skipwhite\|display\|extend\|skipnl\|fold\)\>" |
604 syn cluster vimFuncBodyList add=vimSynMtchGroup | 605 syn cluster vimFuncBodyList add=vimSynMtchGroup |
605 | 606 |
606 " Syntax: off and on {{{2 | 607 " Syntax: off and on {{{2 |
607 syn keyword vimSynType contained enable list manual off on reset | 608 syn keyword vimSynType contained enable list manual off on reset |
608 | 609 |
609 " Syntax: region {{{2 | 610 " Syntax: region {{{2 |
610 syn cluster vimSynRegPatGroup contains=vimPatSep,vimNotPatSep,vimSynPatRange,vimSynNotPatRange,vimSubstSubstr,vimPatRegion,vimPatSepErr,vimNotation | 611 syn cluster vimSynRegPatGroup contains=@vimContinue,vimPatSep,vimNotPatSep,vimSynPatRange,vimSynNotPatRange,vimSubstSubstr,vimPatRegion,vimPatSepErr,vimNotation |
611 syn cluster vimSynRegGroup contains=vimContinue,vimSynCchar,vimSynContains,vimSynNextgroup,vimSynRegOpt,vimSynReg,vimSynMtchGrp | 612 syn cluster vimSynRegGroup contains=@vimContinue,vimSynCchar,vimSynContains,vimSynNextgroup,vimSynRegOpt,vimSynReg,vimSynMtchGrp |
612 syn keyword vimSynType contained region skipwhite nextgroup=vimSynRegion | 613 syn keyword vimSynType contained region skipwhite nextgroup=vimSynRegion |
613 syn region vimSynRegion contained keepend matchgroup=vimGroupName start="\h\w*" skip="\\\\\|\\\|\n\s*\\" end="|\|$" contains=@vimSynRegGroup | 614 syn region vimSynRegion contained keepend matchgroup=vimGroupName start="\h\w*" skip=+\\\\\|\\\|\n\s*\\\|\n\s*"\\ + end="|\|$" contains=@vimSynRegGroup |
614 syn match vimSynRegOpt contained "\%#=1\<\(conceal\(ends\)\=\|transparent\|contained\|excludenl\|skipempty\|skipwhite\|display\|keepend\|oneline\|extend\|skipnl\|fold\)\>" | 615 syn match vimSynRegOpt contained "\%#=1\<\(conceal\(ends\)\=\|transparent\|contained\|excludenl\|skipempty\|skipwhite\|display\|keepend\|oneline\|extend\|skipnl\|fold\)\>" |
615 syn match vimSynReg contained "\(start\|skip\|end\)="he=e-1 nextgroup=vimSynRegPat | 616 syn match vimSynReg contained "\<\%(start\|skip\|end\)=" nextgroup=vimSynRegPat |
616 syn match vimSynMtchGrp contained "matchgroup=" nextgroup=vimGroup,vimHLGroup | 617 syn match vimSynMtchGrp contained "matchgroup=" nextgroup=vimGroup,vimHLGroup |
617 syn region vimSynRegPat contained extend start="\z([-`~!@#$%^&*_=+;:'",./?]\)" skip="\\\\\|\\\z1\|\n\s*\\" end="\z1" contains=@vimSynRegPatGroup skipwhite nextgroup=vimSynPatMod,vimSynReg | 618 syn region vimSynRegPat contained extend start="\z([-`~!@#$%^&*_=+;:'",./?]\)" skip=/\\\\\|\\\z1\|\n\s*\\\|\n\s*"\\ / end="\z1" contains=@vimSynRegPatGroup skipwhite nextgroup=vimSynPatMod,vimSynReg |
618 syn match vimSynPatMod contained "\%#=1\(hs\|ms\|me\|hs\|he\|rs\|re\)=[se]\([-+]\d\+\)\=" | 619 syn match vimSynPatMod contained "\%#=1\(hs\|ms\|me\|hs\|he\|rs\|re\)=[se]\([-+]\d\+\)\=" |
619 syn match vimSynPatMod contained "\%#=1\(hs\|ms\|me\|hs\|he\|rs\|re\)=[se]\([-+]\d\+\)\=," nextgroup=vimSynPatMod | 620 syn match vimSynPatMod contained "\%#=1\(hs\|ms\|me\|hs\|he\|rs\|re\)=[se]\([-+]\d\+\)\=," nextgroup=vimSynPatMod |
620 syn match vimSynPatMod contained "lc=\d\+" | 621 syn match vimSynPatMod contained "lc=\d\+" |
621 syn match vimSynPatMod contained "lc=\d\+," nextgroup=vimSynPatMod | 622 syn match vimSynPatMod contained "lc=\d\+," nextgroup=vimSynPatMod |
622 syn region vimSynPatRange contained start="\[" skip="\\\\\|\\]" end="]" | 623 syn region vimSynPatRange contained start="\[" skip="\\\\\|\\]" end="]" |
706 syn match vimLineComment +^[ \t:]*".*$+ contains=@vimCommentGroup,vimCommentString,vimCommentTitle,vimComment | 707 syn match vimLineComment +^[ \t:]*".*$+ contains=@vimCommentGroup,vimCommentString,vimCommentTitle,vimComment |
707 syn match vimLineComment +^[ \t:]*"\("[^"]*"\|[^"]\)*$+ contains=@vimCommentGroup,vimCommentString,vimCommentTitle | 708 syn match vimLineComment +^[ \t:]*"\("[^"]*"\|[^"]\)*$+ contains=@vimCommentGroup,vimCommentString,vimCommentTitle |
708 syn match vim9LineComment +^[ \t:]\+#.*$+ contains=@vimCommentGroup,vimCommentString,vimCommentTitle | 709 syn match vim9LineComment +^[ \t:]\+#.*$+ contains=@vimCommentGroup,vimCommentString,vimCommentTitle |
709 syn match vimCommentTitle '"\s*\%([sS]:\|\h\w*#\)\=\u\w*\(\s\+\u\w*\)*:'hs=s+1 contained contains=vimCommentTitleLeader,vimTodo,@vimCommentGroup | 710 syn match vimCommentTitle '"\s*\%([sS]:\|\h\w*#\)\=\u\w*\(\s\+\u\w*\)*:'hs=s+1 contained contains=vimCommentTitleLeader,vimTodo,@vimCommentGroup |
710 " Note: Look-behind to work around nextgroup skipnl consuming leading whitespace and preventing a match | 711 " Note: Look-behind to work around nextgroup skipnl consuming leading whitespace and preventing a match |
711 syn match vimContinue "\%(^\s*\)\@32<=\\" | 712 syn match vimContinue "^\s*\zs\\" |
713 syn match vimContinueComment '^\s*\zs["#]\\ .*' contained | |
714 syn cluster vimContinue contains=vimContinue,vimContinueComment | |
712 syn region vimString start="^\s*\\\z(['"]\)" skip='\\\\\|\\\z1' end="\z1" oneline keepend contains=@vimStringGroup,vimContinue | 715 syn region vimString start="^\s*\\\z(['"]\)" skip='\\\\\|\\\z1' end="\z1" oneline keepend contains=@vimStringGroup,vimContinue |
713 syn match vimCommentTitleLeader '"\s\+'ms=s+1 contained | 716 syn match vimCommentTitleLeader '"\s\+'ms=s+1 contained |
714 | 717 |
715 " Searches And Globals: {{{2 | 718 " Searches And Globals: {{{2 |
716 " ==================== | 719 " ==================== |
946 hi def link vimCommentString vimString | 949 hi def link vimCommentString vimString |
947 hi def link vimCommentTitle PreProc | 950 hi def link vimCommentTitle PreProc |
948 hi def link vimCondHL vimCommand | 951 hi def link vimCondHL vimCommand |
949 hi def link vimConst vimCommand | 952 hi def link vimConst vimCommand |
950 hi def link vimContinue Special | 953 hi def link vimContinue Special |
954 hi def link vimContinueComment vimComment | |
951 hi def link vimCtrlChar SpecialChar | 955 hi def link vimCtrlChar SpecialChar |
952 hi def link vimEchoHLNone vimGroup | 956 hi def link vimEchoHLNone vimGroup |
953 hi def link vimEchoHL vimCommand | 957 hi def link vimEchoHL vimCommand |
954 hi def link vimElseIfErr Error | 958 hi def link vimElseIfErr Error |
955 hi def link vimElseif vimCondHL | 959 hi def link vimElseif vimCondHL |
968 hi def link vimFuncKey vimCommand | 972 hi def link vimFuncKey vimCommand |
969 hi def link vimFuncName Function | 973 hi def link vimFuncName Function |
970 hi def link vimFuncSID Special | 974 hi def link vimFuncSID Special |
971 hi def link vimFuncVar Identifier | 975 hi def link vimFuncVar Identifier |
972 hi def link vimGroupAdd vimSynOption | 976 hi def link vimGroupAdd vimSynOption |
973 hi def link vimGroupListContinue vimContinue | |
974 hi def link vimGroupName vimGroup | 977 hi def link vimGroupName vimGroup |
975 hi def link vimGroupRem vimSynOption | 978 hi def link vimGroupRem vimSynOption |
976 hi def link vimGroupSpecial Special | 979 hi def link vimGroupSpecial Special |
977 hi def link vimGroup Type | 980 hi def link vimGroup Type |
978 hi def link vimHiAttrib PreProc | 981 hi def link vimHiAttrib PreProc |