Skip to content

Commit 842c778

Browse files
dkearnschrisbra
authored andcommitted
runtime(vim): Update base syntax, improve :@ highlighting
- Highlight :@ as a normal Ex command rather than something special. - Fix erroneous matching of the Ex command as a register variable. closes: #18624 Signed-off-by: Doug Kearns <[email protected]> Signed-off-by: Christian Brabandt <[email protected]>
1 parent 00e8452 commit 842c778

File tree

13 files changed

+179
-17
lines changed

13 files changed

+179
-17
lines changed

runtime/syntax/generator/vim.vim.base

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
" Language: Vim script
33
" Maintainer: Hirohito Higashi <h.east.727 ATMARK gmail.com>
44
" Doug Kearns <[email protected]>
5-
" Last Change: 2025 Oct 09
5+
" Last Change: 2025 Oct 22
66
" Former Maintainer: Charles E. Campbell
77

88
" DO NOT CHANGE DIRECTLY.
@@ -246,7 +246,7 @@ syn match vimNumber '\<0z\%(\x\x\)\+\%(\.\%(\x\x\)\+\)*' skipwhite nextgroup=@vi
246246
syn case match
247247

248248
" All vimCommands are contained by vimIsCommand. {{{2
249-
syn cluster vimCmdList contains=vimAbb,vimAddress,vimAutocmd,vimAugroup,vimBehave,vimCall,vimCatch,vimCommandModifier,vimConst,vimDoautocmd,vimDebuggreedy,vimDef,vimDefFold,vimDefer,vimDelcommand,vimDelFunction,@vimEcho,vimElse,vimEnddef,vimEndfunction,vimEndif,vimEval,vimExecute,vimIsCommand,vimExtCmd,vimExFilter,vimExMark,vimFiletype,vimFor,vimFunction,vimFunctionFold,vimGrep,vimGrepAdd,vimGlobal,vimHelpgrep,vimHighlight,vimImport,vimLet,vimLoadkeymap,vimLockvar,vimMake,vimMap,vimMark,vimMatch,vimNotFunc,vimNormal,vimProfdel,vimProfile,vimRedir,vimSet,vimSleep,vimSort,vimSyntax,vimSyntime,vimSynColor,vimSynLink,vimTerminal,vimThrow,vimUniq,vimUnlet,vimUnlockvar,vimUnmap,vimUserCmd,vimVimgrep,vimVimgrepadd,vimWincmd,vimMenu,vimMenutranslate,@vim9CmdList,@vimExUserCmdList,vimLua,vimMzScheme,vimPerl,vimPython,vimPython3,vimPythonX,vimRuby,vimTcl
249+
syn cluster vimCmdList contains=vimAbb,vimAddress,vimAt,vimAutocmd,vimAugroup,vimBehave,vimCall,vimCatch,vimCommandModifier,vimConst,vimDoautocmd,vimDebuggreedy,vimDef,vimDefFold,vimDefer,vimDelcommand,vimDelFunction,@vimEcho,vimElse,vimEnddef,vimEndfunction,vimEndif,vimEval,vimExecute,vimIsCommand,vimExtCmd,vimExFilter,vimExMark,vimFiletype,vimFor,vimFunction,vimFunctionFold,vimGrep,vimGrepAdd,vimGlobal,vimHelpgrep,vimHighlight,vimImport,vimLet,vimLoadkeymap,vimLockvar,vimMake,vimMap,vimMark,vimMatch,vimNotFunc,vimNormal,vimProfdel,vimProfile,vimRedir,vimSet,vimSleep,vimSort,vimSyntax,vimSyntime,vimSynColor,vimSynLink,vimTerminal,vimThrow,vimUniq,vimUnlet,vimUnlockvar,vimUnmap,vimUserCmd,vimVimgrep,vimVimgrepadd,vimWincmd,vimMenu,vimMenutranslate,@vim9CmdList,@vimExUserCmdList,vimLua,vimMzScheme,vimPerl,vimPython,vimPython3,vimPythonX,vimRuby,vimTcl
250250
syn cluster vim9CmdList contains=vim9Abstract,vim9Class,vim9Const,vim9Enum,vim9Export,vim9Final,vim9For,vim9Interface,vim9Type,vim9Var
251251
syn match vimCmdSep "\\\@1<!|" skipwhite nextgroup=@vimCmdList,vimSubst1,@vimFunc
252252
syn match vimCmdSep ":\+" skipwhite nextgroup=@vimCmdList,vimSubst1
@@ -1029,7 +1029,13 @@ syn match vimComFilter contained "|!!\=[^"]\{-}\(|\|\ze\"\|$\)" contains=vi
10291029
" Complex Repeats: (:h complex-repeat) {{{2
10301030
" ===============
10311031
syn match vimCmplxRepeat '[^a-zA-Z_/\\()]q[0-9a-zA-Z"]\>'lc=1
1032-
syn match vimCmplxRepeat '@[0-9a-z".=@:]\ze\($\|[^a-zA-Z]\>\)'
1032+
1033+
" NOTE: :* as an alias for :@ is not supported, this is considered a :range,
1034+
" see :help cpo-star
1035+
syn match vimAtArg contained +@\@1<=[0-9a-z".=*+:@]+
1036+
syn match vimAt +@[0-9a-z".=*+:@]\ze\s*\%($\|[|"#]\)+ skipwhite nextgroup=vimCmdSep,vimComment,vim9Comment contains=vimAtArg
1037+
" Vim9: avoid LHS assignment mismatching of :@["#]
1038+
syn match vimAt +@\ze\s*\%($\||\|\s["#]\)+ skipwhite nextgroup=vimCmdSep,vimComment,vim9Comment
10331039

10341040
" Set command and associated set-options (vimOptions) with comment {{{2
10351041
syn match vimSet "\<\%(setl\%[ocal]\|setg\%[lobal]\|se\%[t]\)\>" skipwhite nextgroup=vimSetBang,vimCmdSep,vimComment,vimSetArgs
@@ -2309,6 +2315,8 @@ if !exists("skip_vim_syntax_inits")
23092315

23102316
hi def link vimAbb vimCommand
23112317
hi def link vimAddress vimMark
2318+
hi def link vimAt vimCommand
2319+
hi def link vimAtArg Special
23122320
hi def link vimAugroupBang vimBang
23132321
hi def link vimAugroupError vimError
23142322
hi def link vimAugroupKey vimCommand

runtime/syntax/testdir/dumps/vim9_ex_commands_00.dump

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
@75
44
@75
55
|#+0#0000e05&| |S|T|A|R|T| |N|O|T| |M|A|T|C|H|E|D| +0#0000000&@55
6-
|:|@| @72
7-
|:|@+0#e000e06&@1| +0#0000000&@71
86
|:|N|e|x|t| @69
97
|:|X| @72
108
|#+0#0000e05&| |E|N|D| |N|O|T| |M|A|T|C|H|E|D| +0#0000000&@57
@@ -14,6 +12,8 @@
1412
|:| |h+0#af5f00255&|e|l|p| +0#0000000&@68
1513
@1|:+0#af5f00255&| +0#0000000&|h+0#00e0e07&|e|l|p| +0#0000000&|#+0#0000e05&| |F+0#0000001#ffff4012|I|X|M|E| +0#0000000#ffffff0@59
1614
@75
15+
|:|@+0#af5f00255&| +0#0000000&@72
16+
@75
1717
|:|a+0#af5f00255&|b@1|r|e|v|i|a|t|e| +0#0000000&@63
1818
|:|a+0#af5f00255&|b|c|l|e|a|r| +0#0000000&@66
1919
|:|a+0#af5f00255&|b|o|v|e|l|e|f|t| +0#0000000&@64

runtime/syntax/testdir/dumps/vim9_ex_commands_01.dump

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
|:+0&#ffffff0| |h+0#af5f00255&|e|l|p| +0#0000000&@68
2-
@1|:+0#af5f00255&| +0#0000000&|h+0#00e0e07&|e|l|p| +0#0000000&|#+0#0000e05&| |F+0#0000001#ffff4012|I|X|M|E| +0#0000000#ffffff0@59
1+
| +0&#ffffff0@74
2+
|:|@+0#af5f00255&| +0#0000000&@72
33
@75
44
|:|a+0#af5f00255&|b@1|r|e|v|i|a|t|e| +0#0000000&@63
55
|:|a+0#af5f00255&|b|c|l|e|a|r| +0#0000000&@66
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
>"+0#0000e05#ffffff0| |V|i|m| |:|@| |c|o|m@1|a|n|d| +0#0000000&@58
2+
@75
3+
@75
4+
|@+0#af5f00255&|0+0#e000e06&| +0#0000000&@72
5+
|@+0#af5f00255&|1+0#e000e06&| +0#0000000&@72
6+
|@+0#af5f00255&|2+0#e000e06&| +0#0000000&@72
7+
|@+0#af5f00255&|3+0#e000e06&| +0#0000000&@72
8+
|@+0#af5f00255&|4+0#e000e06&| +0#0000000&@72
9+
|@+0#af5f00255&|5+0#e000e06&| +0#0000000&@72
10+
|@+0#af5f00255&|6+0#e000e06&| +0#0000000&@72
11+
|@+0#af5f00255&|7+0#e000e06&| +0#0000000&@72
12+
|@+0#af5f00255&|8+0#e000e06&| +0#0000000&@72
13+
|@+0#af5f00255&|9+0#e000e06&| +0#0000000&@72
14+
@75
15+
|@+0#af5f00255&|a+0#e000e06&| +0#0000000&@72
16+
|@+0#af5f00255&|k+0#e000e06&| +0#0000000&@72
17+
|@+0#af5f00255&|z+0#e000e06&| +0#0000000&@72
18+
@75
19+
|@+0#af5f00255&|"+0#e000e06&| +0#0000000&@72
20+
@57|1|,|1| @10|T|o|p|
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
| +0&#ffffff0@74
2+
|@+0#af5f00255&|a+0#e000e06&| +0#0000000&@72
3+
|@+0#af5f00255&|k+0#e000e06&| +0#0000000&@72
4+
|@+0#af5f00255&|z+0#e000e06&| +0#0000000&@72
5+
@75
6+
>@+0#af5f00255&|"+0#e000e06&| +0#0000000&@72
7+
|@+0#af5f00255&|.+0#e000e06&| +0#0000000&@72
8+
|@+0#af5f00255&|=+0#e000e06&| +0#0000000&@72
9+
|@+0#af5f00255&|*+0#e000e06&| +0#0000000&@72
10+
|@+0#af5f00255&|++0#e000e06&| +0#0000000&@72
11+
@75
12+
|@+0#af5f00255&|:+0#e000e06&| +0#0000000&@72
13+
@75
14+
|"+0#0000e05&| |r|e|p|e|a|t|s| +0#0000000&@65
15+
|@+0#af5f00255&| +0#0000000&@73
16+
|@+0#af5f00255&|@+0#e000e06&| +0#0000000&@72
17+
@75
18+
|@+0#af5f00255&|a+0#e000e06&| +0#0000000&||| |e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@59
19+
|@+0#af5f00255&|a+0#e000e06&| +0#0000000&|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@62
20+
@57|1|9|,|1| @9|2|7|%|
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
|@+0#af5f00255#ffffff0|a+0#e000e06&| +0#0000000&|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@62
2+
@75
3+
@75
4+
|d+0#af5f00255&|e|f| +0#0000000&|V|i|m|9|C|o|n|t|e|x|t|(+0#e000e06&|)| +0#0000000&@57
5+
@2|:|@+0#af5f00255&|0+0#e000e06&| +0#0000000&@69
6+
@2>:|@+0#af5f00255&|1+0#e000e06&| +0#0000000&@69
7+
@2|:|@+0#af5f00255&|2+0#e000e06&| +0#0000000&@69
8+
@2|:|@+0#af5f00255&|3+0#e000e06&| +0#0000000&@69
9+
@2|:|@+0#af5f00255&|4+0#e000e06&| +0#0000000&@69
10+
@2|:|@+0#af5f00255&|5+0#e000e06&| +0#0000000&@69
11+
@2|:|@+0#af5f00255&|6+0#e000e06&| +0#0000000&@69
12+
@2|:|@+0#af5f00255&|7+0#e000e06&| +0#0000000&@69
13+
@2|:|@+0#af5f00255&|8+0#e000e06&| +0#0000000&@69
14+
@2|:|@+0#af5f00255&|9+0#e000e06&| +0#0000000&@69
15+
@75
16+
@2|:|@+0#af5f00255&|a+0#e000e06&| +0#0000000&@69
17+
@2|:|@+0#af5f00255&|k+0#e000e06&| +0#0000000&@69
18+
@2|:|@+0#af5f00255&|z+0#e000e06&| +0#0000000&@69
19+
@75
20+
@57|3|7|,|3| @9|6|5|%|
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
| +0&#ffffff0@74
2+
@2|:|@+0#af5f00255&|"+0#e000e06&| +0#0000000&@69
3+
@2|:|@+0#af5f00255&|.+0#e000e06&| +0#0000000&@69
4+
@2|:|@+0#af5f00255&|=+0#e000e06&| +0#0000000&@69
5+
@2|:|@+0#af5f00255&|*+0#e000e06&| +0#0000000&@69
6+
@2>:|@+0#af5f00255&|++0#e000e06&| +0#0000000&@69
7+
@75
8+
@2|:|@+0#af5f00255&|:+0#e000e06&| +0#0000000&@69
9+
@75
10+
@2|#+0#0000e05&| |r|e|p|e|a|t|s| +0#0000000&@63
11+
@2|:|@+0#af5f00255&| +0#0000000&@70
12+
@2|:|@+0#af5f00255&|@+0#e000e06&| +0#0000000&@69
13+
@75
14+
@2|:|@+0#af5f00255&|a+0#e000e06&| +0#0000000&||| |e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@56
15+
@2|:|@+0#af5f00255&|a+0#e000e06&| +0#0000000&|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@59
16+
|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68
17+
@75
18+
|~+0#4040ff13&| @73
19+
|~| @73
20+
| +0#0000000&@56|5@1|,|3| @9|B|o|t|

runtime/syntax/testdir/dumps/vim_ex_commands_00.dump

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
@75
33
@75
44
|"+0#0000e05&| |S|T|A|R|T| |N|O|T| |M|A|T|C|H|E|D| +0#0000000&@55
5-
|:|@| @72
6-
|:|@+0#e000e06&@1| +0#0000000&@71
75
|:|N|e|x|t| @69
86
|:|P|r|i|n|t| @68
97
|:|X| @72
@@ -14,6 +12,8 @@
1412
|:| |h+0#af5f00255&|e|l|p| +0#0000000&@68
1513
@1|:+0#af5f00255&| +0#0000000&|h+0#00e0e07&|e|l|p| +0#0000000&|#| |F|I|X|M|E| @59
1614
@75
15+
|:|@+0#af5f00255&| +0#0000000&@72
16+
@75
1717
|:+0#af5f00255&|a|p@1|e|n|d| +0#0000000&@67
1818
| +0#e000002&@3|t|e|x|t| +0#0000000&@66
1919
|.+0#af5f00255&| +0#0000000&@73

runtime/syntax/testdir/dumps/vim_ex_commands_01.dump

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
|:+0&#ffffff0| |h+0#af5f00255&|e|l|p| +0#0000000&@68
2-
@1|:+0#af5f00255&| +0#0000000&|h+0#00e0e07&|e|l|p| +0#0000000&|#| |F|I|X|M|E| @59
1+
| +0&#ffffff0@74
2+
|:|@+0#af5f00255&| +0#0000000&@72
33
@75
44
|:+0#af5f00255&|a|p@1|e|n|d| +0#0000000&@67
55
| +0#e000002&@3|t|e|x|t| +0#0000000&@66

runtime/syntax/testdir/input/vim9_ex_commands.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ vim9script
33

44

55
# START NOT MATCHED
6-
:@
7-
:@@
86
:Next
97
:X
108
# END NOT MATCHED
@@ -14,6 +12,8 @@ vim9script
1412
: help
1513
: help # FIXME
1614

15+
:@
16+
1717
:abbreviate
1818
:abclear
1919
:aboveleft

0 commit comments

Comments
 (0)