#autoload # This should be used to complete parameter names if you need some of the # extra options of compadd. It completes only non-local parameters. # If you specify a -g option with a pattern, the pattern will be used to # restrict the type of parameters matched. local MATCH MBEGIN MEND \ disp dopt expl fakes faked i matches pattern pfilt sep tmp if compset -P '*:'; then _history_modifiers p return fi _tags parameters ( _tags && _requested parameters ) || return pattern=(-g \*) zparseopts -D -K -E g:=pattern fakes=() faked=() if zstyle -a ":completion:${curcontext}:" fake-parameters tmp; then for i in "$tmp[@]"; do if [[ "$i" = *:* ]]; then faked=( "$faked[@]" "$i" ) else fakes=( "$fakes[@]" "$i" ) fi done fi zstyle -t ":completion:${curcontext}:parameters" prefix-needed && \ [[ $PREFIX != [_.]* ]] && \ pfilt='[^_.]' _description parameters expl parameter compadd "$expl[@]" -O matches - \ "${(@M)${(@k)parameters[(R)${pattern[2]}~*local*]}:#${~pfilt}*}" \ "$fakes[@]" \ "${(@)${(@M)faked:#${~pattern[2]}}%%:*}" if zstyle -t ":completion:${curcontext}:parameters" extra-verbose; then zstyle -s ":completion:${curcontext}:parameters" list-separator sep || sep=-- zformat -a disp " $sep " \ ${matches[@]:/(#m)*/"${MATCH}:${${parameters[$MATCH]:#*special*}:+${(Pkv@q+)MATCH}}"} disp=( "${disp[@]:/(#m)*/$MATCH[1,COLUMNS]}" ) dopt=( -d disp ) fi compadd "$expl[@]" $dopt -Q -a matches