Skip to content

Commit 99984fc

Browse files
dkearnschrisbra
authored andcommitted
runtime(vim): Update base-syntax, improve :map highlighting
Match :map ( RHS properly. Only match ! after :map, :noremap, :unmap and :mapclear. closes: #15297 Signed-off-by: Doug Kearns <[email protected]> Signed-off-by: Christian Brabandt <[email protected]>
1 parent 1165f78 commit 99984fc

126 files changed

Lines changed: 786 additions & 561 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

runtime/syntax/generator/gen_syntax_vim.vim

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
" Language: Vim script
33
" Maintainer: Hirohito Higashi (h_east)
44
" URL: https://github.com/vim-jp/syntax-vim-ex
5-
" Last Change: 2024 Apr 07
5+
" Last Change: 2024 Jul 18
66
" Version: 2.1.1
77

88
let s:keepcpo= &cpo
@@ -285,6 +285,7 @@ function! s:get_vim_command_type(cmd_name)
285285
augroup
286286
autocmd
287287
behave
288+
call
288289
catch
289290
def
290291
doautoall
@@ -307,6 +308,7 @@ function! s:get_vim_command_type(cmd_name)
307308
map
308309
mapclear
309310
match
311+
noremap
310312
new
311313
normal
312314
popup
@@ -320,6 +322,7 @@ function! s:get_vim_command_type(cmd_name)
320322
syntax
321323
throw
322324
unlet
325+
unmap
323326
var
324327
vim9script
325328
EOL

runtime/syntax/generator/vim.vim.base

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
" Maintainer: Hirohito Higashi <h.east.727 ATMARK gmail.com>
44
" Doug Kearns <[email protected]>
55
" URL: https://github.com/vim-jp/syntax-vim-ex
6-
" Last Change: 2024 Jul 17
6+
" Last Change: 2024 Jul 18
77
" Former Maintainer: Charles E. Campbell
88

99
" DO NOT CHANGE DIRECTLY.
@@ -185,7 +185,7 @@ syn match vimNumber '\%(^\|\A\)\zs#\x\{6}' skipwhite nextgroup=vimGlobal,vimSub
185185
syn case match
186186

187187
" All vimCommands are contained by vimIsCommand. {{{2
188-
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
188+
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
189189
syn cluster vim9CmdList contains=vim9Const,vim9Final,vim9For,vim9Var
190190
syn match vimCmdSep "[:|]\+" skipwhite nextgroup=@vimCmdList,vimSubst1
191191
syn match vimIsCommand "\<\%(\h\w*\|[23]mat\%[ch]\)\>" contains=vimCommand
@@ -218,6 +218,10 @@ syn match vimBehave "\<be\%[have]\>" nextgroup=vimBehaveBang,vimBehaveModel,vi
218218
syn match vimBehaveBang contained "\a\@1<=!" nextgroup=vimBehaveModel skipwhite
219219
syn keyword vimBehaveModel contained mswin xterm
220220

221+
" Call {{{2
222+
" ====
223+
syn match vimCall "\<call\=\>" skipwhite nextgroup=vimFunc
224+
221225
" Exception Handling {{{2
222226
syn keyword vimThrow th[row] skipwhite nextgroup=@vimExprList
223227
syn keyword vimCatch cat[ch] skipwhite nextgroup=vimCatchPattern
@@ -574,12 +578,14 @@ syn region vimExecute matchgroup=vimCommand start="\<exe\%[cute]\>" skip=+\\|\|\
574578

575579
" Maps: {{{2
576580
" ====
577-
syn match vimMap "\<map\>\ze\s*(\@!" skipwhite nextgroup=vimMapMod,vimMapLhs
578-
syn match vimMap "\<map!" contains=vimMapBang skipwhite nextgroup=vimMapMod,vimMapLhs
579-
" GEN_SYN_VIM: vimCommand map, START_STR='syn keyword vimMap', END_STR='skipwhite nextgroup=vimMapBang,vimMapMod,vimMapLhs'
581+
" GEN_SYN_VIM: vimCommand map, START_STR='syn keyword vimMap', END_STR='skipwhite nextgroup=vimMapMod,vimMapLhs'
582+
syn match vimMap "\<map\>" skipwhite nextgroup=vimMapBang,vimMapMod,vimMapLhs
583+
syn keyword vimMap no[remap] skipwhite nextgroup=vimMapBang,vimMapMod,vimMapLhs
580584
" GEN_SYN_VIM: vimCommand mapclear, START_STR='syn keyword vimMap', END_STR='skipwhite nextgroup=vimMapMod'
581-
syn keyword vimMap mapc[lear] skipwhite nextgroup=vimMapBang,vimMapMod
582-
" GEN_SYN_VIM: vimCommand unmap, START_STR='syn keyword vimUnmap', END_STR='skipwhite nextgroup=vimMapBang,vimMapMod,vimMapLhs'
585+
syn keyword vimMap mapc[lear] skipwhite nextgroup=vimMapBang,vimMapMod
586+
" GEN_SYN_VIM: vimCommand unmap, START_STR='syn keyword vimUnmap', END_STR='skipwhite nextgroup=vimMapMod,vimMapLhs'
587+
syn keyword vimUnmap unm[ap] skipwhite nextgroup=vimMapBang,vimMapMod,vimMapLhs
588+
583589
syn match vimMapLhs contained "\%(.\|\S\)\+" contains=vimCtrlChar,vimNotation skipwhite nextgroup=vimMapRhs
584590
syn match vimMapLhs contained "\%(.\|\S\)\+\ze\s*$" contains=vimCtrlChar,vimNotation skipwhite skipnl nextgroup=vimMapRhsContinue
585591
syn match vimMapBang contained "\a\@1<=!" skipwhite nextgroup=vimMapMod,vimMapLhs
@@ -645,6 +651,8 @@ syn match vimFunc "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%(\w\
645651
syn match vimUserFunc contained "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%(\w\+\.\)*\I[a-zA-Z0-9_.]*\)\|\<\u[a-zA-Z0-9.]*\>\|\<if\>" contains=vimNotation,vimMethodName
646652
syn keyword vimFuncEcho contained ec ech echo
647653

654+
syn match vimMap "\<map\%(\s\+(\)\@=" skipwhite nextgroup=vimMapBang,vimMapMod,vimMapLhs
655+
648656
" User Command Highlighting: {{{2
649657
syn match vimUsrCmd '^\s*\zs\u\%(\w*\)\@>\%([(#[]\|\s\+\%([-+*/%]\=\|\.\.\)=\)\@!'
650658

@@ -1104,6 +1112,7 @@ if !exists("skip_vim_syntax_inits")
11041112
hi def link vimBehaveModel vimBehave
11051113
hi def link vimBehave vimCommand
11061114
hi def link vimBracket Delimiter
1115+
hi def link vimCall vimCommand
11071116
hi def link vimCatch vimCommand
11081117
hi def link vimCmplxRepeat SpecialChar
11091118
hi def link vimCommand Statement

runtime/syntax/testdir/dumps/vim9_ex_commands_09.dump

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717
|:|e+0#af5f00255&|n|d|c|l|a|s@1| +0#0000000&@65
1818
|:|e+0#af5f00255&|n|d|c|l|a|s@1| +0#0000000&@65
1919
|:|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@67
20-
@57|1|6|3|,|1| @8|1|2|%|
20+
@57|1|6|3|,|1| @8|1|3|%|

runtime/syntax/testdir/dumps/vim9_ex_commands_11.dump

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717
|:|g+0#af5f00255&|l|o|b|a|l|/|.+0#0000000&@2|/+0#af5f00255&| +0#0000000&@62
1818
|:|g+0#af5f00255&|o|t|o| +0#0000000&@69
1919
|:|g+0#af5f00255&|r|e|p| +0#0000000&@69
20-
@57|1|9@1|,|1| @8|1|5|%|
20+
@57|1|9@1|,|1| @8|1|6|%|

runtime/syntax/testdir/dumps/vim9_ex_commands_17.dump

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
|:|l+0#af5f00255&|w|i|n|d|o|w| +0#0000000&@66
1313
|:|m+0#af5f00255&|a|k|e| +0#0000000&@69
1414
|:|m+0#af5f00255&|a|p|c|l|e|a|r| +0#0000000&@65
15-
|#+0#0000e05&| |r|e|q|u|i|r|e|s| |t|r|a|i|l|i|n|g| |w|h|i|t|e|s|p|a|c|e| |t|o| |d|i|s|t|i|n|g|u|i|s|h| |f|r|o|m| |m|a|p|(|)| +0#0000000&@18
1615
|:|m+0#af5f00255&|a|p| +0#0000000&@70
1716
|:|m+0#af5f00255&|a|r|k| +0#0000000&@69
1817
|:|m+0#af5f00255&|a|r|k|s| +0#0000000&@68
1918
|:|m+0#af5f00255&|a|t|c|h| +0#0000000&@68
19+
|:|m+0#af5f00255&|e|n|u| +0#0000000&@69
2020
@57|3|0|7|,|1| @8|2|4|%|

runtime/syntax/testdir/dumps/vim9_ex_commands_18.dump

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
|:+0&#ffffff0|m+0#af5f00255&|a|t|c|h| +0#0000000&@68
2-
|:|m+0#af5f00255&|e|n|u| +0#0000000&@69
1+
|:+0&#ffffff0|m+0#af5f00255&|e|n|u| +0#0000000&@69
32
|:|m+0#af5f00255&|e|n|u|t|r|a|n|s|l|a|t|e| +0#0000000&@60
43
|:|m+0#af5f00255&|e|s@1|a|g|e|s| +0#0000000&@65
54
|:|m+0#af5f00255&|k|e|x|r|c| +0#0000000&@67
6-
>:|m+0#af5f00255&|k|s|e|s@1|i|o|n| +0#0000000&@64
7-
|:|m+0#af5f00255&|k|s|p|e|l@1| +0#0000000&@66
5+
|:|m+0#af5f00255&|k|s|e|s@1|i|o|n| +0#0000000&@64
6+
>:|m+0#af5f00255&|k|s|p|e|l@1| +0#0000000&@66
87
|:|m+0#af5f00255&|k|v|i|e|w| +0#0000000&@67
98
|:|m+0#af5f00255&|k|v|i|m|r|c| +0#0000000&@66
109
|:|m+0#af5f00255&|o|v|e| +0#0000000&@69
@@ -17,4 +16,5 @@
1716
|:|n+0#af5f00255&|e|x|t| +0#0000000&@69
1817
|:|n+0#af5f00255&|m|a|p| +0#0000000&@69
1918
|:|n+0#af5f00255&|m|a|p|c|l|e|a|r| +0#0000000&@64
19+
|:|n+0#af5f00255&|m|e|n|u| +0#0000000&@68
2020
@57|3|2|5|,|1| @8|2|6|%|

runtime/syntax/testdir/dumps/vim9_ex_commands_19.dump

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
|:+0&#ffffff0|n+0#af5f00255&|m|a|p|c|l|e|a|r| +0#0000000&@64
2-
|:|n+0#af5f00255&|m|e|n|u| +0#0000000&@68
1+
|:+0&#ffffff0|n+0#af5f00255&|m|e|n|u| +0#0000000&@68
32
|:|n+0#af5f00255&@1|o|r|e|m|a|p| +0#0000000&@65
43
|:|n+0#af5f00255&@1|o|r|e|m|e|n|u| +0#0000000&@64
54
|:|n+0#af5f00255&|o|a|u|t|o|c|m|d| +0#0000000&@64
6-
>:|n+0#af5f00255&|o|h|l|s|e|a|r|c|h| +0#0000000&@63
7-
|:|n+0#af5f00255&|o|r|e|a|b@1|r|e|v| +0#0000000&@63
5+
|:|n+0#af5f00255&|o|h|l|s|e|a|r|c|h| +0#0000000&@63
6+
>:|n+0#af5f00255&|o|r|e|a|b@1|r|e|v| +0#0000000&@63
87
|:|n+0#af5f00255&|o|r|e|m|a|p| +0#0000000&@66
98
|:|n+0#af5f00255&|o|r|e|m|e|n|u| +0#0000000&@65
109
|:|n+0#af5f00255&|o|r|m|a|l| +0#0000000&@67
@@ -17,4 +16,5 @@
1716
|:|o+0#af5f00255&|m|a|p|c|l|e|a|r| +0#0000000&@64
1817
|:|o+0#af5f00255&|m|e|n|u| +0#0000000&@68
1918
|:|o+0#af5f00255&|n|l|y| +0#0000000&@69
19+
|:|o+0#af5f00255&|n|o|r|e|m|a|p| +0#0000000&@65
2020
@57|3|4|3|,|1| @8|2|7|%|

runtime/syntax/testdir/dumps/vim9_ex_commands_20.dump

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
|:+0&#ffffff0|o+0#af5f00255&|n|l|y| +0#0000000&@69
2-
|:|o+0#af5f00255&|n|o|r|e|m|a|p| +0#0000000&@65
1+
|:+0&#ffffff0|o+0#af5f00255&|n|o|r|e|m|a|p| +0#0000000&@65
32
|:|o+0#af5f00255&|n|o|r|e|m|e|n|u| +0#0000000&@64
43
|:|o+0#af5f00255&|p|t|i|o|n|s| +0#0000000&@66
54
|:|o+0#af5f00255&|u|n|m|a|p| +0#0000000&@67
6-
>:|o+0#af5f00255&|u|n|m|e|n|u| +0#0000000&@66
7-
|:|o+0#af5f00255&|w|n|s|y|n|t|a|x| +0#0000000&@64
5+
|:|o+0#af5f00255&|u|n|m|e|n|u| +0#0000000&@66
6+
>:|o+0#af5f00255&|w|n|s|y|n|t|a|x| +0#0000000&@64
87
|:|p+0#af5f00255&|a|c|k|a|d@1| +0#0000000&@66
98
|:|p+0#af5f00255&|a|c|k|l|o|a|d|a|l@1| +0#0000000&@62
109
|:|p+0#af5f00255&|c|l|o|s|e| +0#0000000&@67
@@ -17,4 +16,5 @@
1716
|:|p+0#af5f00255&|r|e|s|e|r|v|e| +0#0000000&@65
1817
|:|p+0#af5f00255&|r|e|v|i|o|u|s| +0#0000000&@65
1918
|:|p+0#af5f00255&|r|i|n|t| +0#0000000&@68
19+
|:|p+0#af5f00255&|r|o|f|d|e|l| +0#0000000&@66
2020
@57|3|6|1|,|1| @8|2|9|%|

runtime/syntax/testdir/dumps/vim9_ex_commands_21.dump

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
|:+0&#ffffff0|p+0#af5f00255&|r|i|n|t| +0#0000000&@68
2-
|:|p+0#af5f00255&|r|o|f|d|e|l| +0#0000000&@66
1+
|:+0&#ffffff0|p+0#af5f00255&|r|o|f|d|e|l| +0#0000000&@66
32
|:|p+0#af5f00255&|r|o|f|i|l|e| +0#0000000&@66
43
|:|p+0#af5f00255&|r|o|m|p|t|f|i|n|d| +0#0000000&@63
54
|:|p+0#af5f00255&|r|o|m|p|t|r|e|p|l| +0#0000000&@63
6-
>:|p+0#af5f00255&|s|e|a|r|c|h| +0#0000000&@66
7-
|:|p+0#af5f00255&|t|a|g| +0#0000000&@69
5+
|:|p+0#af5f00255&|s|e|a|r|c|h| +0#0000000&@66
6+
>:|p+0#af5f00255&|t|a|g| +0#0000000&@69
87
|:|p+0#af5f00255&|t|f|i|r|s|t| +0#0000000&@66
98
|:|p+0#af5f00255&|t|j|u|m|p| +0#0000000&@67
109
|:|p+0#af5f00255&|t|l|a|s|t| +0#0000000&@67
@@ -17,4 +16,5 @@
1716
|:|p+0#af5f00255&|u|b|l|i|c| +0#0000000&@67
1817
|:|p+0#af5f00255&|u|t| +0#0000000&@70
1918
|:|p+0#af5f00255&|w|d| +0#0000000&@70
19+
|:|p+0#af5f00255&|y|3| +0#0000000&@70
2020
@57|3|7|9|,|1| @8|3|0|%|

runtime/syntax/testdir/dumps/vim9_ex_commands_22.dump

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
|:+0&#ffffff0|p+0#af5f00255&|w|d| +0#0000000&@70
2-
|:|p+0#af5f00255&|y|3| +0#0000000&@70
1+
|:+0&#ffffff0|p+0#af5f00255&|y|3| +0#0000000&@70
32
|:|p+0#af5f00255&|y|3|d|o| +0#0000000&@68
43
|:|p+0#af5f00255&|y|3|f|i|l|e| +0#0000000&@66
54
|:|p+0#af5f00255&|y|d|o| +0#0000000&@69
6-
>:|p+0#af5f00255&|y|f|i|l|e| +0#0000000&@67
7-
|:|p+0#af5f00255&|y|t|h|o|n| +0#0000000&@67
5+
|:|p+0#af5f00255&|y|f|i|l|e| +0#0000000&@67
6+
>:|p+0#af5f00255&|y|t|h|o|n| +0#0000000&@67
87
|:|p+0#af5f00255&|y|t|h|o|n|3| +0#0000000&@66
98
|:|p+0#af5f00255&|y|t|h|o|n|x| +0#0000000&@66
109
|:|p+0#af5f00255&|y|x| +0#0000000&@70
@@ -17,4 +16,5 @@
1716
|:|r+0#af5f00255&|e|c|o|v|e|r| +0#0000000&@66
1817
|:|r+0#af5f00255&|e|d|i|r| +0#0000000&@68
1918
|:|r+0#af5f00255&|e|d|o| +0#0000000&@69
19+
|:|r+0#af5f00255&|e|d|r|a|w| +0#0000000&@67
2020
@57|3|9|7|,|1| @8|3|2|%|

0 commit comments

Comments
 (0)