1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-09-22 03:40:47 +02:00
zsh/Completion/Zsh/Command/_alias
Peter Stephenson 61864a802f Jörg Sommer <joerg@alea.gnuu.de>: 25598/25599:
auto-remove automatically added = in alias completion
2008-09-03 09:16:54 +00:00

25 lines
711 B
Plaintext

#compdef alias
local curcontext="$curcontext" state line expl type suf
typeset -A opt_args
_arguments -C -s -A "-*" -S \
'(-r +r -s +s)-+g[list or define global aliases]' \
'(-g +g -s +s)-+r[list or define regular aliases]' \
'(-r +r -g +g)-+s[list or define suffix aliases]' \
'-+m[print aliases matching specified pattern]' \
'-L[print each alias in the form of calls to alias]' \
'*::alias definition:->defn'
if [[ -n "$state" ]]; then
if compset -P 1 '*='; then
compset -q
_normal
else
compset -S '=*' || suf='='
type=( ${opt_args[(i)[-+][grs]]#?} )
(( $#type )) && type=( -s $type )
_wanted -x alias expl 'alias definition' _aliases -qS "$suf" "$type[@]"
fi
fi