Commit: runtime(sh): highlight single-dash short options containing digits

0 views
Skip to first unread message

Christian Brabandt

unread,
Jan 15, 2026, 4:16:17 PM (15 hours ago) Jan 15
to vim...@googlegroups.com
runtime(sh): highlight single-dash short options containing digits

Commit: https://github.com/vim/vim/commit/16c22790627f063981ce75ef3d4da1eb4f6bf8d0
Author: Christian Brabandt <c...@256bit.org>
Date: Thu Jan 15 21:01:43 2026 +0000

runtime(sh): highlight single-dash short options containing digits

fixes: https://github.com/vim/vim/issues/19082

Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/runtime/syntax/sh.vim b/runtime/syntax/sh.vim
index 5cf493065..382d6b177 100644
--- a/runtime/syntax/sh.vim
+++ b/runtime/syntax/sh.vim
@@ -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--[^ $=`'"|);]\+"

" 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
index 000000000..3bb7314e6
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/sh_10_00.dump
@@ -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
index 000000000..74c1ce6c2
--- /dev/null
+++ b/runtime/syntax/testdir/input/sh_10.sh
@@ -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
Reply all
Reply to author
Forward
0 new messages