1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-11-19 13:33:52 +01:00
zsh/Completion/Builtins/_vars
2000-05-31 09:38:25 +00:00

25 lines
567 B
Plaintext

#compdef getopts read unset vared
# This will handle completion of keys of associative arrays, e.g. at
# `vared foo[<TAB>'. However, in this version the [ must be added
# by hand.
if [[ $PREFIX = *\[* ]]; then
local var=${PREFIX%%\[*}
local elt="${PREFIX#*\]}${SUFFIX%\]}"
local addclose
compset -p $(( ${#var} + 1 ))
if ! compset -S \]; then
addclose=(-S ']')
fi
if [[ ${(tP)var} = assoc* ]]; then
local expl
_wanted -C subscript association-keys expl 'association key' \
compadd $addclose -k "$var"
fi
else
_parameters
fi