summary refs log tree commit diff
path: root/Completion/Zsh/Command
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2018-09-03 13:44:36 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2018-09-06 13:58:00 +0000
commitb39a102262ff4810a75bf6b7595ee5195d13939e (patch)
treeb3fb046d46a7b22eb59d824e1ce217419e1737fa /Completion/Zsh/Command
parentf7e874c1018a7748c62c83b1710edf37bb60bde3 (diff)
downloadzsh-b39a102262ff4810a75bf6b7595ee5195d13939e.tar.gz
zsh-b39a102262ff4810a75bf6b7595ee5195d13939e.tar.xz
zsh-b39a102262ff4810a75bf6b7595ee5195d13939e.zip
43366: _compdef: Change and add sources for completed completion function names.
Use ${(v)_comps} instead of going through $fpath again.  Use
${functions} as well to find more legitimate matches, such as various
__git_foo() helpers defined in ${^fpath}/_git.
Diffstat (limited to 'Completion/Zsh/Command')
-rw-r--r--Completion/Zsh/Command/_compdef5
1 files changed, 3 insertions, 2 deletions
diff --git a/Completion/Zsh/Command/_compdef b/Completion/Zsh/Command/_compdef
index 7a64da835..22af7f561 100644
--- a/Completion/Zsh/Command/_compdef
+++ b/Completion/Zsh/Command/_compdef
@@ -1,6 +1,6 @@
 #compdef compdef
 
-local state line expl list disp curcontext="$curcontext" pat normal ret=1
+local state line expl disp curcontext="$curcontext" pat normal ret=1
 local args1 args2
 typeset -A opt_args
 
@@ -57,7 +57,8 @@ case $state in
     _wanted commands expl 'completed command' compadd -k _comps && ret=0
   ;;
   cfun)
-    list=( ${^fpath:/.}/_(|*[^~])(:t) )
+    typeset -aU list=( ${(v)_comps} ${(k)functions[(I)_*]} )
+    (( ${+list[1]} )) || list+=( ${^fpath:/.}/_(|*[^~])(:t) )
     if zstyle -T ":completion:${curcontext}:functions" prefix-hidden; then
       disp=( ${list[@]#_} )
       _wanted functions expl 'completion function' \