From 7b48c52d260c7ca42480adae31e7e4f15ae85714 Mon Sep 17 00:00:00 2001 From: Rizky Ariestiyansyah Date: Thu, 26 Oct 2017 22:50:09 +0700 Subject: [PATCH] Update: Using universal zsh configuration (#5669) * Update install-kubectl.md Zsh is not only oh-my-zsh, so I added universal configuration for zsh that also can be used in prezto. * fix merge error after rebase --- docs/tasks/tools/install-kubectl.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/tasks/tools/install-kubectl.md b/docs/tasks/tools/install-kubectl.md index f7804145dd..d753fff5bf 100644 --- a/docs/tasks/tools/install-kubectl.md +++ b/docs/tasks/tools/install-kubectl.md @@ -187,10 +187,17 @@ kubectl completion bash > $(brew --prefix)/etc/bash_completion.d/kubectl The Homebrew project is independent from Kubernetes, so the bash-completion packages are not guaranteed to work. -### Using zsh +### Using Zsh +If you are using zsh edit the ~/.zshrc file and add the following code to enable kubectl autocompletion: + +```shell +if [ $commands[kubectl] ]; then + source <(kubectl completion zsh) +fi +``` + +Or when using [Oh-My-Zsh](http://ohmyz.sh/), edit the ~/.zshrc file and update the `plugins=` line to include the kubectl plugin. -To add kubectl autocompletion to your ZSH profile, add the following line to -the ~/.zshrc file: ```shell source <(kubectl completion zsh)