Skip to content

Instantly share code, notes, and snippets.

@zikes
Last active November 14, 2022 03:45
Show Gist options
  • Star 14 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zikes/3179da36f3a87aee497398a6e9b88481 to your computer and use it in GitHub Desktop.
Save zikes/3179da36f3a87aee497398a6e9b88481 to your computer and use it in GitHub Desktop.
Using kube-ps1 with P9K
# Enable the kube-ps1 oh-my-zsh plugin
plugins = (
git
kube-ps1
)
# The output of the kube_ps1 function is text, so it can be used
# directly as a custom p9k segment
POWERLEVEL9K_CUSTOM_KUBE_PS1='kube_ps1'
# Include the new custom segment in prompt_elements
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(os_icon context dir custom_kube_ps1 vcs)
@zikes
Copy link
Author

zikes commented Jul 20, 2018

screenshot from 2018-07-20 13-34-36

@zikes
Copy link
Author

zikes commented Jul 20, 2018

Colorless alternative:

zsh_custom_kube_ps1(){
  echo -n "$(_kube_ps1_symbol)$KUBE_PS1_SEPERATOR$KUBE_PS1_CONTEXT$KUBE_PS1_DIVIDER$KUBE_PS1_NAMESPACE"
}
POWERLEVEL9K_CUSTOM_KUBE_PS1='zsh_custom_kube_ps1'

screenshot from 2018-07-20 13-49-33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment