From e12eca77ee6e35ceb6a917097dabde9fcb02fc5a Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 24 Aug 2025 20:08:29 +0800 Subject: [PATCH] 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 --- runtime/syntax/sh.vim | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/runtime/syntax/sh.vim b/runtime/syntax/sh.vim index 9cee161ac2..8dd62566cb 100644 --- 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