Skip to content

Display information about the kubectl current context and namespace in zsh prompt.

License

Notifications You must be signed in to change notification settings

ecv/zsh-kubectl-prompt

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zsh-kubectl-prompt

This script displays information about the kubectl current context and namespace in zsh prompt.

Screenshot

Usage

Clone this repository and source the kubectl.zsh from your ~/.zshrc config file, and configure your prompt.

autoload -U colors; colors
source /path/to/zsh-kubectl-prompt/kubectl.zsh
RPROMPT='%{$fg[blue]%}($ZSH_KUBECTL_PROMPT)%{$reset_color%}'

Also you can install with homebrew.

$ brew tap superbrothers/zsh-kubectl-prompt
$ brew install zsh-kubectl-prompt

Customization

Change the separator between context and namespace:

zstyle ':zsh-kubectl-prompt:' separator '|'

Does not display the current namespace:

zstyle ':zsh-kubectl-prompt:' namespace false

With a plugin manager

If you use zgen, load this repository as follows:

source "${HOME}/.zgen/zgen.zsh"

# if the init script doesn't exist
if ! zgen saved; then
    # specify plugins here
    zgen load superbrothers/zsh-kubectl-prompt

    # generate the init script from plugins above
    zgen save
fi

autoload -U colors; colors
RPROMPT='%{$fg[blue]%}($ZSH_KUBECTL_PROMPT)%{$reset_color%}'

License

This script is released under the MIT License.

About

Display information about the kubectl current context and namespace in zsh prompt.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 66.7%
  • Ruby 33.3%