about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Zsh/Command/_alias13
-rw-r--r--Completion/Zsh/Command/_unhash9
2 files changed, 13 insertions, 9 deletions
diff --git a/Completion/Zsh/Command/_alias b/Completion/Zsh/Command/_alias
index 8feb14a07..8b28f470a 100644
--- a/Completion/Zsh/Command/_alias
+++ b/Completion/Zsh/Command/_alias
@@ -1,11 +1,12 @@
 #compdef alias
 
-local curcontext="$curcontext" state line suf
+local curcontext="$curcontext" state line type suf
+typeset -A opt_args
 
 _arguments -C -s -A "-*" -S \
-  '-+g[list or define global aliases]' \
-  '-+r[list or define regular aliases]' \
-  '-+s[list or define suffix aliases]' \
+  '(-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'
@@ -16,6 +17,8 @@ if [[ -n "$state" ]]; then
     _normal
   else
     compset -S '=*' || suf='='
-    _wanted alias expl 'alias definition' _aliases -S "$suf"
+    type=( ${opt_args[(i)[-+][grs]]#?} )
+    (( $#type )) && type=( -s $type )
+    _wanted -x alias expl 'alias definition' _aliases -S "$suf" "$type[@]"
   fi
 fi
diff --git a/Completion/Zsh/Command/_unhash b/Completion/Zsh/Command/_unhash
index bf74f07c7..54c8d1669 100644
--- a/Completion/Zsh/Command/_unhash
+++ b/Completion/Zsh/Command/_unhash
@@ -3,11 +3,12 @@
 local expl state line curcontext="$curcontext"
 
 _arguments -C -s -S \
-  '(-a -f *)-d[remove named directories]:*:named directory:->nameddir' \
-  '(-d -f *)-a[remove aliases]:*:aliases:_aliases' \
-  '(-d -a *)-f[remove functions]:*:functions:_functions' \
+  '(-a -f -s *)-d[remove named directories]:*:named directory:->nameddir' \
+  '(-d -f -s *)-a[remove aliases]:*:alias:_aliases' \
+  '(-a -d -f *)-s[remove suffix aliases]:*:suffix alias:_aliases -s s' \
+  '(-d -a -s *)-f[remove functions]:*:function:_functions' \
   '-m[treat arguments as patterns]' \
-  '(-a -d -f -m)*:commands: _command_names -e' && return 0
+  '(-a -d -f -m)*:command: _command_names -e' && return 0
 
 [[ "$state" = nameddir ]] &&
   _wanted named-directories expl 'named directory' compadd -k nameddirs