]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
runtime(sh): highlight single-dash short options containing digits
authorChristian Brabandt <cb@256bit.org>
Thu, 15 Jan 2026 21:01:43 +0000 (21:01 +0000)
committerChristian Brabandt <cb@256bit.org>
Thu, 15 Jan 2026 21:01:43 +0000 (21:01 +0000)
fixes: #19082

Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/syntax/sh.vim
runtime/syntax/testdir/dumps/sh_10_00.dump [new file with mode: 0644]
runtime/syntax/testdir/input/sh_10.sh [new file with mode: 0644]

index 5cf4930658432130d14d83a8761e3adb69b52332..382d6b177ed4f3bb9f8323db2c833edfad501f5b 100644 (file)
@@ -19,6 +19,7 @@
 "              2025 Jul 18 properly delete :commands #17785
 "              2025 Aug 23 bash: add support for ${ cmd;} and ${|cmd;} #18084
 "              2025 Sep 23 simplify ksh logic, update sh statements #18355
+"              2026 Jan 15 highlight command switches that contain a digit
 " }}}
 " Version:             208
 " Former URL:          http://www.drchip.org/astronaut/vim/index.html#SYNTAX_SH
@@ -345,7 +346,7 @@ endif
 
 " Options: {{{1
 " ====================
-syn match   shOption   "\s\zs[-+][-_a-zA-Z#@]\+"
+syn match   shOption   "\s\zs[-+][-_a-zA-Z#@0-9]\+"
 syn match   shOption   "\s\zs--[^ \t$=`'"|);]\+"
 
 " File Redirection Highlighted As Operators: {{{1
diff --git a/runtime/syntax/testdir/dumps/sh_10_00.dump b/runtime/syntax/testdir/dumps/sh_10_00.dump
new file mode 100644 (file)
index 0000000..3bb7314
--- /dev/null
@@ -0,0 +1,20 @@
+>c+0&#ffffff0|u|r|l| |-+0#e000e06&@1|h|t@1|p|2| +0#0000000&|-+0#e000e06&@1|t|l|s|v|1|.|2| +0#0000000&|-+0#e000e06&|O| +0#0000000&|h|t@1|p|s|:|/@1|e|x|a|m|p|l|e|.|c|o|m|/|f|i|l|e|.|t|x|t| @20
+|w|g|e|t| |-+0#e000e06&@1|i|n|e|t|6|-|o|n|l|y| +0#0000000&|h|t@1|p|s|:|/@1|e|x|a|m|p|l|e|.|c|o|m|/|f|i|l|e|.|t|x|t| @28
+|g|z|i|p| |-+0#e000002&|9| +0#0000000&|f|i|l|e| @62
+|x|z| |-+0#e000e06&|T|0| +0#0000000&|f|i|l|e| @63
+|f+0#af5f00255&|i|n|d| +0#0000000&|/|t|m|p| |-+0#e000e06&|t|y|p|e| +0#0000000&|f| |-+0#e000e06&|p|r|i|n|t|0| +0#0000000&||| |x+0#af5f00255&|a|r|g|s| +0#0000000&|-+0#e000002&|0| +0#0000000&|e+0#af5f00255&|c|h|o| +0#0000000&@33
+|c+0#af5f00255&|u|t| +0#0000000&|-+0#e000e06&|f|1| +0#0000000&|f|i|l|e| @62
+|n+0#af5f00255&|i|c|e| +0#0000000&|-+0#e000e06&|n|1|0| +0#0000000&|m|a|k|e| |-+0#e000e06&|j|4| +0#0000000&@56
+|k+0#af5f00255&|i|l@1| +0#0000000&|-+0#e000002&|9| +0#0000000&|1+0#e000002&|2|3|4|5| +0#0000000&@61
+|t+0#af5f00255&|a|i|l| +0#0000000&|-+0#e000e06&|n|1|0| +0#0000000&|e|r@1|o|r|.|l|o|g| @55
+|g|i|t| |l|o|g| |-+0#e000e06&|n|1|0| +0#0000000&@62
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|i+0#0000000&|s|_|d|a|s|h|:| |1|,| |i|s|_|p|o|s|i|x|:| |1|,| |i|s|_|s|h|:| |1|,| @22|1|,|1| @10|A|l@1| 
diff --git a/runtime/syntax/testdir/input/sh_10.sh b/runtime/syntax/testdir/input/sh_10.sh
new file mode 100644 (file)
index 0000000..74c1ce6
--- /dev/null
@@ -0,0 +1,10 @@
+curl --http2 --tlsv1.2 -O https://example.com/file.txt
+wget --inet6-only https://example.com/file.txt
+gzip -9 file
+xz -T0 file
+find /tmp -type f -print0 | xargs -0 echo
+cut -f1 file
+nice -n10 make -j4
+kill -9 12345
+tail -n10 error.log
+git log -n10