diff --git a/zsh.d/kubernetes.zsh b/zsh.d/kubernetes.zsh new file mode 100644 index 0000000..7fb05fd --- /dev/null +++ b/zsh.d/kubernetes.zsh @@ -0,0 +1,13 @@ + +if command-exists "kubectl"; then + source <(kubectl completion zsh) +fi + +if command-exists "k3s"; then + source <(k3s completion zsh) +fi + +if command-exists "minikube"; then + source <(minikube completion zsh) +fi + diff --git a/zshrc b/zshrc index de48dd1..355ca5b 100644 --- a/zshrc +++ b/zshrc @@ -368,24 +368,6 @@ store_last_return_value() { # This must be exactly first precmd function, because other precmd might modify $? precmd_functions=(store_last_return_value $precmd_functions) -# If kubectl is present, load completions from it. -# This must be done after compinit was called -if [[ $commands[kubectl] ]]; then - source <(kubectl completion zsh) -fi - -# If k3s is present, load completions from it. -# This must be done after compinit was called -if [[ $commands[k3s] ]]; then - source <(k3s completion zsh) -fi - -# If minikube is present, load completions from it. -# This must be done after compinit was called -if [[ $commands[minikube] ]]; then - source <(minikube completion zsh) -fi - zmodload zsh/complist #---------------------------------- Partials ------------------------------------