]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
runtime(vim): Update base syntax, contain user command replacement text
authorDoug Kearns <dougkearns@gmail.com>
Wed, 1 Oct 2025 21:03:22 +0000 (21:03 +0000)
committerChristian Brabandt <cb@256bit.org>
Wed, 1 Oct 2025 21:03:22 +0000 (21:03 +0000)
Ensure that :command replacement text terminates at the end of the
logical line.

Add :command to the generator exclusion list.

fixes: #18414 (@Dougaak)
fixes: #18448 (Maxim Kim)
closes: #18415

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
15 files changed:
runtime/syntax/generator/gen_syntax_vim.vim
runtime/syntax/generator/vim.vim.base
runtime/syntax/testdir/dumps/vim_ex_command_01.dump
runtime/syntax/testdir/dumps/vim_ex_command_02.dump
runtime/syntax/testdir/dumps/vim_ex_command_03.dump
runtime/syntax/testdir/dumps/vim_ex_command_04.dump
runtime/syntax/testdir/dumps/vim_ex_command_05.dump
runtime/syntax/testdir/dumps/vim_ex_command_06.dump
runtime/syntax/testdir/dumps/vim_ex_command_07.dump
runtime/syntax/testdir/dumps/vim_ex_command_08.dump
runtime/syntax/testdir/dumps/vim_ex_command_09.dump
runtime/syntax/testdir/dumps/vim_ex_command_10.dump
runtime/syntax/testdir/dumps/vim_ex_command_11.dump [new file with mode: 0644]
runtime/syntax/testdir/input/vim_ex_command.vim
runtime/syntax/vim.vim

index 9e45b97f1d79edbf1ffe55d12d17d726d49e8a24..9ecab6e7eada5743d1d15cc53d446f29ca511996 100644 (file)
@@ -1,7 +1,7 @@
 " Vim syntax file generator
 " Language:             Vim script
 " Maintainer:  Hirohito Higashi (h_east)
-" Last Change: 2025 Sep 23
+" Last Change: 2025 Sep 27
 
 let s:keepcpo= &cpo
 set cpo&vim
@@ -307,6 +307,7 @@ function s:get_vim_command_type(cmd_name)
                catch
                chdir
                class
+               command
                copy
                debuggreedy
                def
index fbca93451ddcbad26ae3e192f9dcd41f910d0c0a..3f983e71a8b716b24d1ad32439c8f7964d3a9eea 100644 (file)
@@ -863,6 +863,7 @@ syn region  vimUserCmdReplacement contained
       \ skip=+\n\s*\%(\\\|["#]\\ \)+
       \ end="$"
       \ contains=@vimContinue,@vimUserCmdList,vimComFilter
+      \ keepend
 syn region     vimUserCmdBlock     contained
       \ matchgroup=vimSep
       \ start="{"
index bbe9104e2109828a142decfda59012fe92d68719..78492c7f3d01051c563369c8091aff72048da48f 100644 (file)
@@ -17,4 +17,4 @@
 @6|\+0#e000e06&| +0#0000000&|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|F|o@1|"| +0#0000000&@56
 @75
 |c+0#af5f00255&|o|m@1|a|n|d|!| +0#0000000&|-+0#e000e06&|a|d@1|r|=|a+0#00e0003&|r|g|u|m|e|n|t|s| +0#0000000&|-+0#e000e06&|b|a|n|g| +0#0000000&|-+0#e000e06&|b|a|r| +0#0000000&|-+0#e000e06&|b|u|f@1|e|r| +0#0000000&|-+0#e000e06&|c|o|m|p|l|e|t|e|=|a+0#00e0003&|r|g|l|i|s|t| +0#0000000&|-+0#e000e06&|c|o|u|n|t|=|1+0#e000002&| +0#0000000&|-+0#e000e06&|@+0#4040ff13&@2
-| +0#0000000&@56|1|9|,|1| @10|8|%| 
+| +0#0000000&@56|1|9|,|1| @10|7|%| 
index 86712c1e8101fb9c654ae119e2658cfb0033da8f..dd95498f4e6ffaff5986747b10837dfba4f1ee9e 100644 (file)
@@ -17,4 +17,4 @@
 @75
 |c+0#af5f00255&|o|m@1|a|n|d|!| +0#0000000&|-+0#e000e06&|c|o|m|p|l|e|t|e|=|c+0#00e0003&|u|s|t|o|m|,+0#0000000&|s+0#00e0e07&|:|C|o|m|p|l|e|t|e|r|1| +0#0000000&|F+0#0000001#ffff4012|o@1| +0#0000000#ffffff0|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|F|o@1|"| +0#0000000&@21
 |c+0#af5f00255&|o|m@1|a|n|d|!| +0#0000000&|-+0#e000e06&|c|o|m|p|l|e|t|e|=|c+0#00e0003&|u|s|t|o|m|l|i|s|t|,+0#0000000&|s+0#00e0e07&|:|C|o|m|p|l|e|t|e|r|2| +0#0000000&|F+0#0000001#ffff4012|o@1| +0#0000000#ffffff0|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|F|o@1|"| +0#0000000&@17
-@57|3|4|,|1| @9|1|8|%| 
+@57|3|4|,|1| @9|1|6|%| 
index 3502efb843d04b53518a149732703808f007468f..aa0e2f0c3268ae38f930ebf7f40ecf03b17a4f9e 100644 (file)
@@ -17,4 +17,4 @@
 @6|\+0#e000e06&| +0#0000000&|-+0#e000e06&|b|u|f@1|e|r| +0#0000000&@59
 @6|\+0#e000e06&| +0#0000000&|-+0#e000e06&|c|o|m|p|l|e|t|e|=|b+0#00e0003&|u|f@1|e|r| +0#0000000&@50
 @6|\+0#e000e06&| +0#0000000&|-+0#e000e06&|c|o|u|n|t| +0#0000000&@60
-@57|5|0|,|0|-|1| @7|2|9|%| 
+@57|5|0|,|0|-|1| @7|2|4|%| 
index 8827d57081efbf009eea19b2823aaf14a6c2bc20..c819f228cd10ed81019349ab9ea56e57b7e1137d 100644 (file)
@@ -17,4 +17,4 @@
 @6|\+0#e000e06&| +0#0000000&|-+0#e000e06&|n|a|r|g|s|=|*+0#00e0003&| +0#0000000&@58
 @6|\+0#e000e06&| +0#0000000&|-+0#e000e06&|r|a|n|g|e| +0#0000000&@60
 @6|\+0#e000e06&| +0#0000000&|-+0#e000e06&|r|e|g|i|s|t|e|r| +0#0000000&@57
-@57|6|8|,|7| @9|4|1|%| 
+@57|6|8|,|7| @9|3|5|%| 
index 21edaa64bcd354e3732fc4a9b3b032158c6d1ff6..d5cccc3289ce6f1b784faf2afca33d0cc3d17d1a 100644 (file)
@@ -17,4 +17,4 @@
 @6|"+0#0000e05&|\| |c|o|m@1|e|n|t| +0#0000000&@58
 @6|\+0#e000e06&| +0#0000000&|-+0#e000e06&|c|o|u|n|t| +0#0000000&@60
 @6|"+0#0000e05&|\| |c|o|m@1|e|n|t| +0#0000000&@58
-@57|8|6|,|0|-|1| @7|5|2|%| 
+@57|8|6|,|0|-|1| @7|4|5|%| 
index 766150a8209c8a9a820c9b49ee3763aa70815f6f..ce8e7965780b2888a3852eeec80064e22b60e1de 100644 (file)
@@ -17,4 +17,4 @@
 |"+0#0000e05&| |E|r@1|o|r|s| +0#0000000&@66
 @75
 |c+0#af5f00255&|o|m@1|a|n|d|!| +0#0000000&|-+0#ffffff16#ff404010|b|a|d|a|t@1|r|=+0#0000000#ffffff0|a|r|g|u|m|e|n|t|s| |-+0#e000e06&|b|a|n|g| +0#0000000&|-+0#ffffff16#ff404010|b|a|d|a|t@1|r| +0#0000000#ffffff0|-+0#e000e06&|n|a|r|g|s|=|*+0#00e0003&| +0#0000000&|F+0#0000001#ffff4012|o@1| +0#0000000#ffffff0|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|F|o@1|"| +0#0000000&@8
-@57|1|0|4|,|7| @8|6|4|%| 
+@57|1|0|4|,|7| @8|5@1|%| 
index f63dbd998fa1d9daa08857d42df8515e667a2eea..e88760eaa3fba05e53513da446ebb27ab4f07f32 100644 (file)
@@ -17,4 +17,4 @@
 |c+0#af5f00255&|o|m|c|l|e|a|r| +0#0000000&||| |e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|F|o@1|"| +0#0000000&@53
 @75
 @75
-@57|1|2@1|,|1| @8|7|6|%| 
+@57|1|2@1|,|1| @8|6|5|%| 
index e6792e6a9072c7b870fbbecae93ab26dd3775b67..63a768760de9c1469e226a38ac209be166d269db 100644 (file)
@@ -17,4 +17,4 @@
 |"|•|"|,| |"|g|"|)|/+0#e000e06&|g|e| +0#0000000&@62
 @4|e+0#af5f00255&|n|d|i|f| +0#0000000&@65
 @4|i+0#af5f00255&|f| +0#0000000&|"+0#e000002&|<|a|r|g|s|>|"| +0#0000000&|=+0#af5f00255&@1| +0#0000000&|"+0#e000002&@1| +0#0000000&@53
-@57|1|4|0|,|0|-|1| @6|8@1|%| 
+@57|1|4|0|,|0|-|1| @6|7|5|%| 
index 7b81de09ce4b2971d25e125aca226d54a0d09cf3..bc89f17530ad532f95beec0f287b703b5429ccc0 100644 (file)
@@ -13,8 +13,8 @@
 @75
 @75
 |"+0#0000e05&| |U|n|r|e|p|o|r|t|e|d| |i|s@1|u|e| |(|:|m|a|p| |w|i|t|h| |t|r|a|i|l|i|n|g| |b|a|r| |i|n| |r|e|p|l|a|c|e|m|e|n|t| |t|e|x|t|)| +0#0000000&@11
+@75
 |c+0#af5f00255&|o|m@1|a|n|d|!| +0#0000000&|F+0#0000001#ffff4012|o@1| +0#0000000#ffffff0@62
 @6|\+0#e000e06&| +0#0000000&|m+0#af5f00255&|a|p| +0#0000000&|l|h|s| |r|h|s| ||| @53
 @6|\+0#e000e06&| +0#0000000&|a+0#af5f00255&|b@1|r|e|v|i|a|t|e| +0#0000000&|f|o@1| |b|a|r| ||| @46
-@6|\+0#e000e06&| +0#0000000&|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|F|o@1|"| +0#0000000&@56
-@57|1|5|7|,|5| @8|9@1|%| 
+@57|1|5|7|,|5| @8|8|4|%| 
index 31663553c5d43aa212431ccb6e07dbe100a48a38..5cc86bdcf2e14a287082ae7fdce7c7fbed5f49b4 100644 (file)
@@ -1,20 +1,20 @@
-| +0&#ffffff0@5|\+0#e000e06&| +0#0000000&|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|F|o@1|"| +0#0000000&@56
+| +0&#ffffff0@5|\+0#e000e06&| +0#0000000&|a+0#af5f00255&|b@1|r|e|v|i|a|t|e| +0#0000000&|f|o@1| |b|a|r| ||| @46
+@6|\+0#e000e06&| +0#0000000&|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|F|o@1|"| +0#0000000&@56
+@75
+@75
+|"+0#0000e05&| |I|s@1|u|e| |#|1|8|4|1|4| |(|S|y|n|t|a|x| |g|r|o|u|p| |v|i|m|U|s|e|r|C|m|d|R|e|p|l|a|c|e|m|e|n|t| |l|a|c|k|i|n|g| |a| |k|e@1|p|e|n|d|?|)| +0#0000000&@4
 > @74
-|~+0#4040ff13&| @73
-|~| @73
-|~| @73
-|~| @73
-|~| @73
-|~| @73
-|~| @73
-|~| @73
-|~| @73
-|~| @73
-|~| @73
-|~| @73
-|~| @73
-|~| @73
-|~| @73
-|~| @73
-|~| @73
-| +0#0000000&@56|1|7|0|,|0|-|1| @6|B|o|t| 
+|d+0#af5f00255&|e|f| +0#0000000&|V|i|m|9|C|o|n|t|e|x|t|(+0#e000e06&|)| +0#0000000&@57
+@2|c+0#af5f00255&|o|m@1|a|n|d|!| +0#0000000&|M+0#0000001#ffff4012|y|F|u|n|c|t|i|o|n| +0#0000000#ffffff0|M|y|F|u|n|c|(+0#e000e06&|)| +0#0000000&@44
+@2|#+0#0000e05&| |I| |a|m| |a| |c|o|m@1|e|n|t| +0#0000000&@56
+@75
+@2|c+0#af5f00255&|o|m@1|a|n|d|!| +0#0000000&|T+0#0000001#ffff4012|o|g@1|l|e|W|r|a|p| +0#0000000#ffffff0|s+0#af5f00255&|e|t|l|o|c|a|l| +0#0000000&|w+0#e000e06&|r|a|p|!| +0#0000000&@38
+@2|#+0#0000e05&| |I| |a|m| |a| |c|o|m@1|e|n|t| |b|u|t| |I| |d|i|d|n|'|t| |g|e|t| |h|i|g|h|l|i|g|h|t|e|d| +0#0000000&@27
+|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68
+@75
+|c+0#af5f00255&|o|m@1|a|n|d|!| +0#0000000&|M+0#0000001#ffff4012|y|F|u|n|c|t|i|o|n| +0#0000000#ffffff0|c+0#af5f00255&|a|l@1| +0#0000000&|M|y|F|u|n|c|(+0#e000e06&|)| +0#0000000&@41
+|"+0#0000e05&| |I| |a|m| |a| |c|o|m@1|e|n|t| +0#0000000&@58
+@75
+|c+0#af5f00255&|o|m@1|a|n|d|!| +0#0000000&|T+0#0000001#ffff4012|o|g@1|l|e|W|r|a|p| +0#0000000#ffffff0|s+0#af5f00255&|e|t|l|o|c|a|l| +0#0000000&|w+0#e000e06&|r|a|p|!| +0#0000000&@40
+|"+0#0000e05&| |I| |a|m| |a| |c|o|m@1|e|n|t| |b|u|t| |I| |d|i|d|n|'|t| |g|e|t| |h|i|g|h|l|i|g|h|t|e|d| +0#0000000&@29
+@57|1|7|4|,|0|-|1| @6|9|4|%| 
diff --git a/runtime/syntax/testdir/dumps/vim_ex_command_11.dump b/runtime/syntax/testdir/dumps/vim_ex_command_11.dump
new file mode 100644 (file)
index 0000000..1e50b3f
--- /dev/null
@@ -0,0 +1,20 @@
+|"+0#0000e05#ffffff0| |I| |a|m| |a| |c|o|m@1|e|n|t| |b|u|t| |I| |d|i|d|n|'|t| |g|e|t| |h|i|g|h|l|i|g|h|t|e|d| +0#0000000&@29
+@75
+@75
+|"+0#0000e05&| |I|s@1|u|e| |#|1|8|4@1|8| |(|c|o|m@1|e|n|t| |f|o|r| |s|u|b|s|e|q|u|e|n|t| |c|o|m@1|a|n|d| |i|s| |n|o|t| |h|i|g|h|l|i|g|h|t|e|d|)| +0#0000000&@8
+@75
+>d+0#af5f00255&|e|f| +0#0000000&|V|i|m|9|C|o|n|t|e|x|t|(+0#e000e06&|)| +0#0000000&@57
+@2|c+0#af5f00255&|o|m@1|a|n|d|!| +0#0000000&|-+0#e000e06&|n|a|r|g|s|=|1+0#00e0003&| +0#0000000&|-+0#e000e06&|c|o|m|p|l|e|t|e|=|f+0#00e0003&|i|l|e| +0#0000000&|R+0#0000001#ffff4012|g| +0#0000000#ffffff0|:|t+0#af5f00255&|e|r|m| +0#0000000&|r|g| |<|a|r|g|s|>| @21
+@2|#+0#0000e05&| |c|o|m@1|a|n|d|!| |-|n|a|r|g|s|=|1| |-|c|o|m|p|l|e|t|e|=|f|i|l|e| |R|g| |:|t|e|r|m| |+@1|s|h|e|l@1| |r|g| |<|a|r|g|s|>| +0#0000000&@11
+|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68
+@75
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|1|9|2|,|1| @8|B|o|t| 
index 56890143c722f93c2da3be8d9f92a6254501a806..a2f01a708e984e0e13baab946fcefabb19cb37f3 100644 (file)
@@ -163,8 +163,34 @@ command -range=% -nargs=? -bang Tb :<line1>,<line2>s/\v"[^"]*"/\=substitute(subm
 
 
 " Unreported issue (:map with trailing bar in replacement text)
+
 command! Foo
       \ map lhs rhs |
       \ abbreviate foo bar |
       \ echo "Foo"
 
+
+" Issue #18414 (Syntax group vimUserCmdReplacement lacking a keepend?)
+
+def Vim9Context()
+  command! MyFunction MyFunc()
+  # I am a comment
+
+  command! ToggleWrap setlocal wrap!
+  # I am a comment but I didn't get highlighted
+enddef
+
+command! MyFunction call MyFunc()
+" I am a comment
+
+command! ToggleWrap setlocal wrap!
+" I am a comment but I didn't get highlighted
+
+
+" Issue #18448 (comment for subsequent command is not highlighted)
+
+def Vim9Context()
+  command! -nargs=1 -complete=file Rg :term rg <args>
+  # command! -nargs=1 -complete=file Rg :term ++shell rg <args>
+enddef
+
index 426674e97625dfa548da4c0a2d4a2f6fd7dbeed0..1fbb2f64d2639e31e03177f7f259495cd7cacbc4 100644 (file)
@@ -919,6 +919,7 @@ syn region  vimUserCmdReplacement contained
       \ skip=+\n\s*\%(\\\|["#]\\ \)+
       \ end="$"
       \ contains=@vimContinue,@vimUserCmdList,vimComFilter
+      \ keepend
 syn region     vimUserCmdBlock     contained
       \ matchgroup=vimSep
       \ start="{"