Skip to content

Commit 60bd140

Browse files
dkearnschrisbra
authored andcommitted
runtime(vim): Update base-syntax, match Vim9 function calls after "|"
Match Vim9 function calls after ex-bar. These are also currently matched but invalid syntax for legacy script. fixes: #16721 closes: #16747 Signed-off-by: Doug Kearns <dougkearns@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
1 parent e9ae35f commit 60bd140

6 files changed

Lines changed: 70 additions & 4 deletions

File tree

runtime/syntax/generator/vim.vim.base

Lines changed: 3 additions & 2 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 <dougkearns@gmail.com>
5-
" Last Change: 2025 Feb 23
5+
" Last Change: 2025 Feb 27
66
" Former Maintainer: Charles E. Campbell
77

88
" DO NOT CHANGE DIRECTLY.
@@ -204,7 +204,8 @@ syn case match
204204
" All vimCommands are contained by vimIsCommand. {{{2
205205
syn cluster vimCmdList contains=vimAbb,vimAddress,vimAutoCmd,vimAugroup,vimBehave,vimCall,vimCatch,vimConst,vimDebuggreedy,vimDef,vimDefFold,vimDelcommand,@vimEcho,vimEnddef,vimEndfunction,vimExecute,vimIsCommand,vimExtCmd,vimFor,vimFunction,vimFuncFold,vimGlobal,vimHighlight,vimLet,vimLoadkeymap,vimLockvar,vimMap,vimMark,vimMatch,vimNotFunc,vimNormal,vimSet,vimSleep,vimSyntax,vimThrow,vimUnlet,vimUnlockvar,vimUnmap,vimUserCmd,vimMenu,vimMenutranslate,@vim9CmdList,@vimExUserCmdList
206206
syn cluster vim9CmdList contains=vim9Abstract,vim9Class,vim9Const,vim9Enum,vim9Export,vim9Final,vim9For,vim9Interface,vim9Type,vim9Var
207-
syn match vimCmdSep "[:|]\+" skipwhite nextgroup=@vimCmdList,vimSubst1
207+
syn match vimCmdSep "\\\@1<!|" skipwhite nextgroup=@vimCmdList,vimSubst1,vimFunc
208+
syn match vimCmdSep ":\+" skipwhite nextgroup=@vimCmdList,vimSubst1
208209
syn match vimCount contained "\d\+"
209210
syn match vimIsCommand "\<\%(\h\w*\|[23]mat\%[ch]\)\>" nextgroup=vimBang contains=vimCommand
210211
syn match vimBang contained "!"
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
>v+0#af5f00255#ffffff0|i|m|9|s|c|r|i|p|t| +0#0000000&@64
2+
@75
3+
|#+0#0000e05&| |V|i|m|9| |f|u|n|c|t|i|o|n| |c|a|l@1|s| +0#0000000&@53
4+
@75
5+
|c+0#00e0e07&|l|e|a|r|m|a|t|c|h|e|s|(+0#e000e06&|)| +0#0000000&@60
6+
|:|c+0#af5f00255&|a|l@1| +0#0000000&|c+0#00e0e07&|l|e|a|r|m|a|t|c|h|e|s|(+0#e000e06&|)| +0#0000000&@54
7+
|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|F|o@1|"| +0#0000000&||| |c+0#00e0e07&|l|e|a|r|m|a|t|c|h|e|s|(+0#e000e06&|)| +0#0000000&@47
8+
@75
9+
@75
10+
|#+0#0000e05&| |I|s@1|u|e| |1|6|7|2|1| |(|v|i|m|s|c|r|i|p|t| |h|i|g|h|l|i|g|h|t| |o|f| |b|u|i|l|t|i|n| |f|u|n|c|t|i|o|n| |a|f|t|e|r| |||)| +0#0000000&@11
11+
@75
12+
|&+0#00e0e07&|d|i|r|e|c|t|o|r|y| +0#0000000&|=+0#af5f00255&| +0#0000000&|$+0#e000002&|'|{+0#e000e06&|$|M|Y|V|I|M|D|I|R|}|/+0#e000002&|.|d|a|t|a|/|s|w|a|p|/|'| +0#0000000&@35
13+
|&+0#00e0e07&|b|a|c|k|u|p|d|i|r| +0#0000000&|=+0#af5f00255&| +0#0000000&|$+0#e000002&|'|{+0#e000e06&|$|M|Y|V|I|M|D|I|R|}|/+0#e000002&|.|d|a|t|a|/|b|a|c|k|u|p|/@1|'| +0#0000000&@32
14+
|&+0#00e0e07&|u|n|d|o|d|i|r| +0#0000000&|=+0#af5f00255&| +0#0000000&|$+0#e000002&|'|{+0#e000e06&|$|M|Y|V|I|M|D|I|R|}|/+0#e000002&|.|d|a|t|a|/|u|n|d|o|/@1|'| +0#0000000&@36
15+
|i+0#af5f00255&|f| +0#0000000&|!+0#af5f00255&|i+0#00e0e07&|s|d|i|r|e|c|t|o|r|y|(+0#e000e06&|&+0#00e0e07&|u|n|d|o|d|i|r|)+0#e000e06&| +0#0000000&@2||| |m+0#00e0e07&|k|d|i|r|(+0#e000e06&|&+0#00e0e07&|u|n|d|o|d|i|r|,+0#0000000&| |"+0#e000002&|p|"|)+0#e000e06&| +0#0000000&@2||| |e+0#af5f00255&|n|d|i|f| +0#0000000&@14
16+
|i+0#af5f00255&|f| +0#0000000&|!+0#af5f00255&|i+0#00e0e07&|s|d|i|r|e|c|t|o|r|y|(+0#e000e06&|&+0#00e0e07&|b|a|c|k|u|p|d|i|r|)+0#e000e06&| +0#0000000&||| |m+0#00e0e07&|k|d|i|r|(+0#e000e06&|&+0#00e0e07&|b|a|c|k|u|p|d|i|r|,+0#0000000&| |"+0#e000002&|p|"|)+0#e000e06&| +0#0000000&||| |e+0#af5f00255&|n|d|i|f| +0#0000000&@14
17+
|i+0#af5f00255&|f| +0#0000000&|!+0#af5f00255&|i+0#00e0e07&|s|d|i|r|e|c|t|o|r|y|(+0#e000e06&|&+0#00e0e07&|d|i|r|e|c|t|o|r|y|)+0#e000e06&| +0#0000000&||| |m+0#00e0e07&|k|d|i|r|(+0#e000e06&|&+0#00e0e07&|d|i|r|e|c|t|o|r|y|,+0#0000000&| |"+0#e000002&|p|"|)+0#e000e06&| +0#0000000&||| |e+0#af5f00255&|n|d|i|f| +0#0000000&@14
18+
@75
19+
|~+0#4040ff13&| @73
20+
| +0#0000000&@56|1|,|1| @10|A|l@1|
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| |f|u|n|c|t|i|o|n| |c|a|l@1|s| +0#0000000&@54
2+
@75
3+
|c+0#af5f00255&|a|l@1| +0#0000000&|c+0#00e0e07&|l|e|a|r|m|a|t|c|h|e|s|(+0#e000e06&|)| +0#0000000&@55
4+
|:|c+0#af5f00255&|a|l@1| +0#0000000&|c+0#00e0e07&|l|e|a|r|m|a|t|c|h|e|s|(+0#e000e06&|)| +0#0000000&@54
5+
|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|F|o@1|"| +0#0000000&||| |c+0#af5f00255&|a|l@1| +0#0000000&|c+0#00e0e07&|l|e|a|r|m|a|t|c|h|e|s|(+0#e000e06&|)| +0#0000000&@42
6+
@75
7+
|~+0#4040ff13&| @73
8+
|~| @73
9+
|~| @73
10+
|~| @73
11+
|~| @73
12+
|~| @73
13+
|~| @73
14+
|~| @73
15+
|~| @73
16+
|~| @73
17+
|~| @73
18+
|~| @73
19+
|~| @73
20+
| +0#0000000&@56|1|,|1| @10|A|l@1|
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
vim9script
2+
3+
# Vim9 function calls
4+
5+
clearmatches()
6+
:call clearmatches()
7+
echo "Foo" | clearmatches()
8+
9+
10+
# Issue 16721 (vimscript highlight of builtin function after |)
11+
12+
&directory = $'{$MYVIMDIR}/.data/swap/'
13+
&backupdir = $'{$MYVIMDIR}/.data/backup//'
14+
&undodir = $'{$MYVIMDIR}/.data/undo//'
15+
if !isdirectory(&undodir) | mkdir(&undodir, "p") | endif
16+
if !isdirectory(&backupdir) | mkdir(&backupdir, "p") | endif
17+
if !isdirectory(&directory) | mkdir(&directory, "p") | endif
18+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
" Vim function calls
2+
3+
call clearmatches()
4+
:call clearmatches()
5+
echo "Foo" | call clearmatches()
6+

runtime/syntax/vim.vim

Lines changed: 3 additions & 2 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 <dougkearns@gmail.com>
5-
" Last Change: 2025 Feb 23
5+
" Last Change: 2025 Feb 27
66
" Former Maintainer: Charles E. Campbell
77

88
" DO NOT CHANGE DIRECTLY.
@@ -242,7 +242,8 @@ syn case match
242242
" All vimCommands are contained by vimIsCommand. {{{2
243243
syn cluster vimCmdList contains=vimAbb,vimAddress,vimAutoCmd,vimAugroup,vimBehave,vimCall,vimCatch,vimConst,vimDebuggreedy,vimDef,vimDefFold,vimDelcommand,@vimEcho,vimEnddef,vimEndfunction,vimExecute,vimIsCommand,vimExtCmd,vimFor,vimFunction,vimFuncFold,vimGlobal,vimHighlight,vimLet,vimLoadkeymap,vimLockvar,vimMap,vimMark,vimMatch,vimNotFunc,vimNormal,vimSet,vimSleep,vimSyntax,vimThrow,vimUnlet,vimUnlockvar,vimUnmap,vimUserCmd,vimMenu,vimMenutranslate,@vim9CmdList,@vimExUserCmdList
244244
syn cluster vim9CmdList contains=vim9Abstract,vim9Class,vim9Const,vim9Enum,vim9Export,vim9Final,vim9For,vim9Interface,vim9Type,vim9Var
245-
syn match vimCmdSep "[:|]\+" skipwhite nextgroup=@vimCmdList,vimSubst1
245+
syn match vimCmdSep "\\\@1<!|" skipwhite nextgroup=@vimCmdList,vimSubst1,vimFunc
246+
syn match vimCmdSep ":\+" skipwhite nextgroup=@vimCmdList,vimSubst1
246247
syn match vimCount contained "\d\+"
247248
syn match vimIsCommand "\<\%(\h\w*\|[23]mat\%[ch]\)\>" nextgroup=vimBang contains=vimCommand
248249
syn match vimBang contained "!"

0 commit comments

Comments
 (0)