dfaad779a9bbe1f83e30820d227d4b7870bdf33f

Author
Marc Cornellà <hello@mcornella.com>
Committer
Marc Cornellà <hello@mcornella.com>
Date

Message

fix(helm): fix completion loading mechanism

Diff

 1diff --git a/plugins/helm/helm.plugin.zsh b/plugins/helm/helm.plugin.zsh
 2index c6b91693a4c4302bd2cf5d0b028bde88e15f17f2..cadfa551a6a67852402d1621270ae51d8830106c 100644
 3--- a/plugins/helm/helm.plugin.zsh
 4+++ b/plugins/helm/helm.plugin.zsh
 5@@ -11,12 +11,12 @@ command rm -f "${ZSH_CACHE_DIR}/helm_completion"
 6 command mkdir -p "$ZSH_CACHE_DIR/completions"
 7 (( ${fpath[(Ie)"$ZSH_CACHE_DIR/completions"]} )) || fpath=("$ZSH_CACHE_DIR/completions" $fpath)
 8 
 9-# If the completion file doesn't exist yet, we need to autoload it and
10-# bind it to `helm`. Otherwise, compinit will have already done that.
11+# If the completion file does not exist, generate it and then source it
12+# Otherwise, source it and regenerate in the background
13 if [[ ! -f "$ZSH_CACHE_DIR/completions/_helm" ]]; then
14-  typeset -g -A _comps
15-  autoload -Uz _helm
16-  _comps[helm]=_helm
17+  helm completion zsh >| "$ZSH_CACHE_DIR/completions/_helm"
18+  source "$ZSH_CACHE_DIR/completions/_helm"
19+else
20+  source "$ZSH_CACHE_DIR/completions/_helm"
21+  helm completion zsh >| "$ZSH_CACHE_DIR/completions/_helm" &|
22 fi
23-
24-helm completion zsh >| "$ZSH_CACHE_DIR/completions/_helm" &|