about summary refs log tree commit diff
path: root/Completion/Builtins/_compdef
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Builtins/_compdef')
-rw-r--r--Completion/Builtins/_compdef12
1 files changed, 7 insertions, 5 deletions
diff --git a/Completion/Builtins/_compdef b/Completion/Builtins/_compdef
index 1df5758b3..4208c2689 100644
--- a/Completion/Builtins/_compdef
+++ b/Completion/Builtins/_compdef
@@ -1,6 +1,6 @@
 #compdef compdef
 
-local func base=2
+local expl func base=2
 
 while [[ $words[base] = -* ]]; do
   case $words[base] in
@@ -12,11 +12,13 @@ while [[ $words[base] = -* ]]; do
 done
 
 if [ "$delete" ]; then
-  compadd ${(k)_comps}
+  _description expl 'completed command'
+  compadd "$expl[@]" - ${(k)_comps}
 else
-  if [[ CURRENT -eq base  ]]; then
-    for func in ${^~fpath:/.}/_(|*[^~])(N:t); compadd -P_ - ${func#_}
+  if [[ CURRENT -eq base ]]; then
+    _description expl 'completion function'
+    compadd "$expl[@]" - ${^fpath:/.}/_(|*[^~])(N:t)
   else
-    compgen -c
+    _command_names
   fi
 fi