diff options
-rw-r--r-- | README.md | 2 | ||||
-rwxr-xr-x | powerlevel9k.zsh-theme | 27 |
2 files changed, 16 insertions, 13 deletions
@@ -1,6 +1,6 @@ ![](https://raw.githubusercontent.com/bhilburn/powerlevel9k-logo/master/logo-banner.png) --- -[![Build Status](https://travis-ci.org/bhilburn/powerlevel9k.svg?branch=next)](https://travis-ci.org/bhilburn/powerlevel9k) +[![Build Status](https://travis-ci.org/bhilburn/powerlevel9k.svg?branch=master)](https://travis-ci.org/bhilburn/powerlevel9k) [![Join the chat at https://gitter.im/bhilburn/powerlevel9k](https://badges.gitter.im/bhilburn/powerlevel9k.svg)](https://gitter.im/bhilburn/powerlevel9k?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) Powerlevel9k is a theme for ZSH which uses [Powerline diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 73178865..33f8a50b 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -1379,18 +1379,10 @@ prompt_virtualenv() { } # pyenv: current active python version (with restrictions) -# More information on pyenv (Python version manager like rbenv and rvm): -# https://github.com/yyuu/pyenv -# the prompt parses output of pyenv version and only displays the first word +# https://github.com/pyenv/pyenv#choosing-the-python-version prompt_pyenv() { - local pyenv_version="$(pyenv version 2>/dev/null)" - pyenv_version="${pyenv_version%% *}" - # XXX: The following should return the same as above. - # This reads better for devs familiar with sed/awk/grep/cut utilities - # Using shell expansion/substitution may hamper future maintainability - #local pyenv_version="$(pyenv version 2>/dev/null | head -n1 | cut -d' ' -f1)" - if [[ -n "$pyenv_version" && "$pyenv_version" != "system" ]]; then - "$1_prompt_segment" "$0" "$2" "blue" "$DEFAULT_COLOR" "$pyenv_version" 'PYTHON_ICON' + if [[ -n "$PYENV_VERSION" ]]; then + "$1_prompt_segment" "$0" "$2" "blue" "$DEFAULT_COLOR" "$PYENV_VERSION" 'PYTHON_ICON' fi } @@ -1423,7 +1415,18 @@ prompt_kubecontext() { if [[ -z "$k8s_namespace" ]]; then k8s_namespace="default" fi - "$1_prompt_segment" "$0" "$2" "magenta" "white" "$k8s_context/$k8s_namespace" "KUBERNETES_ICON" + + local k8s_final_text="" + + if [[ "$k8s_context" == "k8s_namespace" ]]; then + # No reason to print out the same identificator twice + k8s_final_text="$k8s_context" + else + k8s_final_text="$k8s_context/$k8s_namespace" + fi + + + "$1_prompt_segment" "$0" "$2" "magenta" "white" "$k8s_final_text" "KUBERNETES_ICON" fi } |