commit fdf20f32eea6ae2569d800dedae3eecac0fb9b72
parent 172776b4598085c70897a0aa0d31a983dcd4c94d
Author: zeertzjq <zeertzjq@outlook.com>
Date: Mon, 16 Feb 2026 08:44:36 +0800
vim-patch:c68e64d: runtime(sh): fix spurious nextgroup=shComment on shEscape
Remove `nextgroup=shComment` from the `shEscape` syntax pattern.
This was causing `#` characters after escape sequences inside
double-quoted strings to be misinterpreted as comments, breaking
highlighting for the rest of the file.
Add a test case for escaped characters followed by # in double quotes.
fixes: vim/vim#19053
closes: vim/vim#19414
https://github.com/vim/vim/commit/c68e64dac3eaa48d65bb333c66b3d34707dd6acc
Co-authored-by: Bozhidar Batsov <bozhidar@batsov.dev>
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/runtime/syntax/sh.vim b/runtime/syntax/sh.vim
@@ -21,6 +21,7 @@
" 2025 Sep 23 simplify ksh logic, update sh statements #18355
" 2026 Jan 15 highlight command switches that contain a digit
" 2026 Feb 11 improve support for KornShell function names and variables
+" 2026 Feb 15 improve comment handling #19414
" }}}
" Version: 208
" Former URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_SH
@@ -452,7 +453,7 @@ endif
"======
syn match shWrapLineOperator "\\$"
syn region shCommandSubBQ start="`" skip="\\\\\|\\." end="`" contains=shBQComment,@shCommandSubList
-syn match shEscape contained '\%(^\)\@!\%(\\\\\)*\\.' nextgroup=shComment
+syn match shEscape contained '\%(^\)\@!\%(\\\\\)*\\.'
" $() and $(()): {{{1
" $(..) is not supported by sh (Bourne shell). However, apparently