#compdef -subscript- local expl if [[ "$PREFIX" = :* ]]; then _wanted characters expl 'character class' && compadd "$expl[@]" -p: -S ':]' alnum alpha blank cntrl digit graph \ lower print punct space upper xdigit elif [[ ${(Pt)${compstate[parameter]}} = assoc* ]]; then _wanted association-keys expl 'association key' && if [[ "$RBUFFER" = \]* ]]; then compadd "$expl[@]" -S '' - "${(@kP)${compstate[parameter]}}" else compadd "$expl[@]" -S ']' - "${(@kP)${compstate[parameter]}}" fi elif [[ ${(Pt)${compstate[parameter]}} = array* ]]; then local list i j ret=1 disp _tags indices parameters while _tags; do if _requested -V indices expl 'array index'; then ind=( {1..${#${(P)${compstate[parameter]}}}} ) if zstyle -t ":completion${curcontext}:indices" verbose; then list=() for i in "$ind[@]"; do [[ "$i" = ${PREFIX}*${SUFFIX} ]] && list=( "$list[@]" "${i}:$(print -D ${(P)${compstate[parameter]}[$i]})" ) done zformat -a list ' -- ' "$list[@]" disp=( -d list) else disp=() fi if [[ "$RBUFFER" = \]* ]]; then compadd "$expl[@]" -S '' "$disp[@]" - "$ind[@]" && ret=0 else compadd "$expl[@]" -S ']' "$disp[@]" - "$ind[@]" && ret=0 fi fi _requested parameters && _parameters && ret=0 (( ret )) || return 0 done return 1 else _compalso -math- fi