1diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh
2index 095d2b3281abc9cde3f5f60320ad24ff2c530167..b415d1ad888f5791ca99855cfd72f614104f14dd 100644
3--- a/plugins/kubectl/kubectl.plugin.zsh
4+++ b/plugins/kubectl/kubectl.plugin.zsh
5@@ -1,15 +1,17 @@
6-if (( $+commands[kubectl] )); then
7- # If the completion file does not exist, generate it and then source it
8- # Otherwise, source it and regenerate in the background
9- if [[ ! -f "$ZSH_CACHE_DIR/completions/_kubectl" ]]; then
10- kubectl completion zsh | tee "$ZSH_CACHE_DIR/completions/_kubectl" >/dev/null
11- source "$ZSH_CACHE_DIR/completions/_kubectl"
12- else
13- source "$ZSH_CACHE_DIR/completions/_kubectl"
14- kubectl completion zsh | tee "$ZSH_CACHE_DIR/completions/_kubectl" >/dev/null &|
15- fi
16+if (( ! $+commands[kubectl] )); then
17+ return
18 fi
1920+# If the completion file doesn't exist yet, we need to autoload it and
21+# bind it to `kubectl`. Otherwise, compinit will have already done that.
22+if [[ ! -f "$ZSH_CACHE_DIR/completions/_kubectl" ]]; then
23+ typeset -g -A _comps
24+ autoload -Uz _kubectl
25+ _comps[kubectl]=_kubectl
26+fi
27+
28+kubectl completion zsh >| "$ZSH_CACHE_DIR/completions/_kubectl" &|
29+
30 # This command is used a LOT both below and in daily life
31 alias k=kubectl
32