'main': Highlight array parameters in command position.

This commit is contained in:
Daniel Shahaf 2018-01-12 13:54:02 +00:00
commit 1bf54d7f26
2 changed files with 14 additions and 2 deletions

View file

@ -513,7 +513,17 @@ _zsh_highlight_highlighter_main_paint()
[[ ${parameter_name} =~ ^([A-Za-z_][A-Za-z0-9_]*|[0-9]+)$ ]] &&
(( ${+parameters[${MATCH}]} ))
then
arg=${(P)MATCH}
# Set $arg.
case ${(tP)MATCH} in
(*array*|*assoc*)
local -a words=( ${(P)MATCH} )
arg=${words[1]}
;;
(*)
# scalar, presumably
arg=${(P)MATCH}
;;
esac
_zsh_highlight_main__type "$arg"
res=$REPLY
fi