Bravo
Bravo

Reputation: 9047

how to install kubectl autocompletion plugin for zsh?

I installed ohmyz.sh , on my mac book , i want to install kubectl autocompletion plugin for zsh , but not aware of the steps to install , can any one help on this please ?

Upvotes: 6

Views: 15926

Answers (2)

Manu Artero
Manu Artero

Reputation: 10263

Another option: I like having the following setup;

~/.zshrc: define which plugins I want to load

...

plugins=(
  git
  ...
  kubectl
)

...

~/.oh-my-zsh/custom/plugins/*: define my custom plugins, in this case override the kubectl from OhMyZsh with the file that this command generates:

kubectl completion zsh > ~/.oh-my-zsh/custom/plugins/kubectl.plugin.zsh

working setup

Upvotes: 11

nickgryg
nickgryg

Reputation: 28713

According to official kubectl documentation:

when using Oh-My-Zsh, edit the ~/.zshrc file and update the plugins= line to include the kubectl plugin.

source <(kubectl completion zsh)

Upvotes: 7

Related Questions