diff options
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rwxr-xr-x | powerlevel9k.zsh-theme | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 8578e6f2..831e81c5 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -696,7 +696,10 @@ set_default POWERLEVEL9K_DIR_PATH_SEPARATOR "/" set_default POWERLEVEL9K_HOME_FOLDER_ABBREVIATION "~" set_default POWERLEVEL9K_DIR_SHOW_WRITABLE false prompt_dir() { + local tmp="$IFS" + local IFS="" local current_path=$(pwd | sed -e "s,^$HOME,~,") + local IFS="$tmp" if [[ -n "$POWERLEVEL9K_SHORTEN_DIR_LENGTH" || "$POWERLEVEL9K_SHORTEN_STRATEGY" == "truncate_with_folder_marker" ]]; then set_default POWERLEVEL9K_SHORTEN_DELIMITER $'\U2026' @@ -1384,18 +1387,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 } @@ -1440,11 +1435,11 @@ prompt_kubecontext() { local k8s_final_text="" - if [[ "$k8s_context" == "k8s_namespace" ]]; then + if [[ "$cur_ctx" == "cur_namespace" ]]; then # No reason to print out the same identificator twice - k8s_final_text="$k8s_context" + k8s_final_text="$cur_ctx" else - k8s_final_text="$k8s_context/$k8s_namespace" + k8s_final_text="$cur_ctx/$cur_namespace" fi "$1_prompt_segment" "$0" "$2" "magenta" "white" "$k8s_final_text" "KUBERNETES_ICON" |