diff options
author | romkatv <roman.perepelitsa@gmail.com> | 2020-05-02 15:32:17 +0300 |
---|---|---|
committer | romkatv <roman.perepelitsa@gmail.com> | 2020-05-02 15:32:17 +0300 |
commit | fdb0bb6af70c0ee70454fe456b4b40a9bba15118 (patch) | |
tree | b1de98a5bee5aa7cbe8a676b9c2a8fe19a66cf8a | |
parent | 459af1f2382ff53214bf9e4fc598b4e36fb8f8df (diff) |
set P9K_PYENV_PYTHON_VERSION in prompt_pyenv; see #679
-rw-r--r-- | internal/p10k.zsh | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/internal/p10k.zsh b/internal/p10k.zsh index 6dc2e8a4..8ba844f3 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -4038,6 +4038,8 @@ function _p9k_pyenv_global_version() { # Segment to display pyenv information # https://github.com/pyenv/pyenv#choosing-the-python-version prompt_pyenv() { + unset P9K_PYENV_PYTHON_VERSION + local v=${(j.:.)${(@)${(s.:.)PYENV_VERSION}#python-}} if [[ -n $v ]]; then (( ${_POWERLEVEL9K_PYENV_SOURCES[(I)shell]} )) || return @@ -4084,6 +4086,14 @@ prompt_pyenv() { [[ $v == system ]] && return fi + local versions=${PYENV_ROOT:-$HOME/.pyenv}/versions + versions=${versions:A} + local version=$versions/$v + version=${version:A} + if [[ $version == (#b)$versions/([^/]##)* ]]; then + typeset -g P9K_PYENV_PYTHON_VERSION=$match[1] + fi + _p9k_prompt_segment "$0" "blue" "$_p9k_color1" 'PYTHON_ICON' 0 '' "${v//\%/%%}" } |