mirror of
https://github.com/zsh-users/zsh-syntax-highlighting.git
synced 2025-12-04 21:56:45 +01: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
1 changed files with 1 additions and 1 deletions
|
|
@ -153,7 +153,7 @@ _zsh_highlight_main_highlighter()
|
||||||
_zsh_highlight_main_highlighter_check_assign()
|
_zsh_highlight_main_highlighter_check_assign()
|
||||||
{
|
{
|
||||||
setopt localoptions extended_glob
|
setopt localoptions extended_glob
|
||||||
[[ $arg == [[:alpha:]_]([[:alnum:]_])#=* ]]
|
[[ $arg == [[:alpha:]_][[:alnum:]_]#(|\[*\])=* ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check if the argument is a path.
|
# Check if the argument is a path.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue