]> git.ipfire.org Git - thirdparty/vim.git/commit
runtime(sh): allow "#" in special derefs master
authorD. Ben Knoble <ben.knoble+github@gmail.com>
Tue, 21 Apr 2026 19:59:07 +0000 (19:59 +0000)
committerChristian Brabandt <cb@256bit.org>
Tue, 21 Apr 2026 19:59:07 +0000 (19:59 +0000)
commit10040bc9cde340c52b5093cacb1d60fd2e621883
treed1269ea307ca97e546b83b64e3dfeb59b6831fbf
parent33f3965087b01dccf4382ed419d34799ffd66cd9
runtime(sh): allow "#" in special derefs

Code like ${!#} flags the "#" as shDerefWordError [1]; the "!prefix"
syntax region delegates to one of the shDerefSpecial handlers via
@shDerefList, but it misses the "#" case as valid for ${##} and ${!#}.

[1]: https://vi.stackexchange.com/q/48617/10604

Correct that. Indirection is only valid in Bash in Ksh, so rearrange the
"!" handling to be conditional.

closes: #20016

Helped-by: Christian Brabandt <cb@256bit.org>
Signed-off-by: D. Ben Knoble <ben.knoble+github@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/syntax/sh.vim
runtime/syntax/testdir/dumps/sh_03_01.dump
runtime/syntax/testdir/dumps/sh_03_02.dump
runtime/syntax/testdir/dumps/sh_bash_00.dump
runtime/syntax/testdir/dumps/sh_bash_01.dump
runtime/syntax/testdir/dumps/sh_bash_02.dump
runtime/syntax/testdir/input/sh_03.sh
runtime/syntax/testdir/input/sh_bash.bash