mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-11-20 05:53:52 +01:00
26 lines
475 B
Plaintext
26 lines
475 B
Plaintext
#compdef getopts unset vared
|
|
|
|
# This will handle completion of keys of associative arrays, e.g. at
|
|
# `vared foo[<TAB>'.
|
|
|
|
local ret=1
|
|
|
|
if [[ $PREFIX = *\[* ]]; then
|
|
compstate[parameter]=${PREFIX%%(|\\)\[*}
|
|
|
|
IPREFIX=${PREFIX%%\[*}\[
|
|
PREFIX=${PREFIX#*\[}
|
|
|
|
_subscript -q
|
|
else
|
|
_parameters -g '^a*' "$@" && ret=0
|
|
|
|
if compset -S '\[*'; then
|
|
set - -S "" "$@"
|
|
else
|
|
set - -qS"${${QIPREFIX:+[}:-\[}" "$@"
|
|
fi
|
|
_parameters -g 'a*' "$@" && ret=0
|
|
return ret
|
|
fi
|