mirror of
https://github.com/zsh-users/zsh-syntax-highlighting.git
synced 2025-10-23 15:46:27 +08:00
highlight array assignments of the form x[y]=...
This code is more lenient than bash. Examples:
$ x[y[]=
zsh: no matches found: x[y[]=
$ x[][]=
zsh: no matches found: x[][]=
The proper solution is to look inside the [...] and make sure that all
unescaped/unquoted square brackes are matched, but that is a heck of
a lot more complicated than this simple 8-character patch.
This commit is contained in:
parent
c62cb54e9d
commit
441f1a8aad
@ -153,7 +153,7 @@ _zsh_highlight_main_highlighter()
|
||||
_zsh_highlight_main_highlighter_check_assign()
|
||||
{
|
||||
setopt localoptions extended_glob
|
||||
[[ $arg == [[:alpha:]_]([[:alnum:]_])#=* ]]
|
||||
[[ $arg == [[:alpha:]_][[:alnum:]_]#(|\[*\])=* ]]
|
||||
}
|
||||
|
||||
# Check if the argument is a path.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user