commit 45e905481319cdf4fcfe5910987baba0f6b80732
parent ac670989980a599c545bc754de559adbcae19845
Author: zeertzjq <zeertzjq@outlook.com>
Date: Wed, 7 May 2025 09:45:19 +0800
vim-patch:fe22867: runtime(sh): Update syntax, fix single-quoted strings in parameter expansions
Ignore single-quoted backslash escape sequences in parameter expansions.
\' is not an escaped single quote in ${foo:-'word\'}.
closes: vim/vim#17261
https://github.com/vim/vim/commit/fe22867ef564ea78cafaabe0c784222638399cb9
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/runtime/syntax/sh.vim b/runtime/syntax/sh.vim
@@ -11,6 +11,7 @@
" 2025 Apr 03 command substitution opening paren at EOL (#17026)
" 2025 Apr 10 improve shell detection (#17084)
" 2025 Apr 29 match escaped chars in test operands (#17221)
+" 2025 May 06 improve single-quote string matching in parameter expansions
" Version: 208
" Former URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_SH
" For options and settings, please use: :help ft-sh-syntax
@@ -649,7 +650,7 @@ if exists("b:is_bash")
syn match shDerefOp contained "[,^]\{1,2}" nextgroup=@shDerefPatternList
syn match shDerefOp contained "@[uULQEPAKa]"
endif
-syn region shDerefString contained matchgroup=shDerefDelim start=+\%(\\\)\@<!'+ end=+'+ contains=shStringSpecial
+syn region shDerefString contained matchgroup=shDerefDelim start=+\%(\\\)\@<!'+ end=+'+
syn region shDerefString contained matchgroup=shDerefDelim start=+\%(\\\)\@<!"+ skip=+\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial
syn match shDerefString contained "\\["']" nextgroup=shDerefPattern