commit e12eca77ee6e35ceb6a917097dabde9fcb02fc5a
parent 53802da38bb2134da6ec9b4e02a01ab002f2d3c6
Author: zeertzjq <zeertzjq@outlook.com>
Date: Sun, 24 Aug 2025 20:08:29 +0800
vim-patch:e06d81f: runtime(sh): add syntax highlighting support for ${ cmd;} and ${|cmd;}
bash 5.3 (released July 2025) added support for ${ cmd;} and
${|cmd;} style command substitution, which is similar (but not
identical) to ksh/mksh.
closes: vim/vim#18084
https://github.com/vim/vim/commit/e06d81fe675794d6e849cfa78e31a78c8001bbe5
Co-authored-by: Kevin Pulo <kevin.pulo@mongodb.com>
Diffstat:
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/runtime/syntax/sh.vim b/runtime/syntax/sh.vim
@@ -16,7 +16,8 @@
" 2025 May 10 improve wildcard character class lists
" 2025 May 21 improve supported KornShell features
" 2025 Jun 16 change how sh_fold_enabled is reset (#17557)
-" 2025 Jul 18 properly delete :commands #17785
+" 2025 Jul 18 properly delete :commands (#17785)
+" 2025 Aug 23 bash: add support for ${ cmd;} and ${|cmd;} (#18084)
" }}}
" Version: 208
" Former URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_SH
@@ -474,6 +475,9 @@ if exists("b:is_kornshell") || exists("b:is_bash") || exists("b:is_posix")
if exists("b:is_mksh") || exists("b:generic_korn")
syn region shValsub matchgroup=shCmdSubRegion start="\${|" skip='\\\\\|\\.' end="}" contains=@shCommandSubList
endif
+ elseif exists("b:is_bash")
+ syn region shSubshare matchgroup=shCmdSubRegion start="\${\ze[ \t\n]" skip='\\\\\|\\.' end="\zs[;\n][ \t\n]*}" contains=@shCommandSubList
+ syn region shValsub matchgroup=shCmdSubRegion start="\${|" skip='\\\\\|\\.' end="[;\n][ \t\n]*}" contains=@shCommandSubList
endif
syn region shArithmetic matchgroup=shArithRegion start="\$((" skip='\\\\\|\\.' end="))" contains=@shArithList
syn region shArithmetic matchgroup=shArithRegion start="\$\[" skip='\\\\\|\\.' end="\]" contains=@shArithList
@@ -677,6 +681,8 @@ if exists("b:is_kornshell") && !exists("b:is_ksh88")
else
syn region shDeref matchgroup=PreProc start="\${\ze[^ \t\n<]" end="}" contains=@shDerefList,shDerefVarArray nextgroup=shSpecialStart
endif
+elseif exists("b:is_bash")
+ syn region shDeref matchgroup=PreProc start="\${\ze[^ \t\n|]" end="}" contains=@shDerefList,shDerefVarArray nextgroup=shSpecialStart
else
syn region shDeref matchgroup=PreProc start="\${" end="}" contains=@shDerefList,shDerefVarArray nextgroup=shSpecialStart
endif