mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-11 00:00:06 +00:00
set P9K_PYENV_PYTHON_VERSION in prompt_pyenv; see #679
This commit is contained in:
parent
459af1f238
commit
fdb0bb6af7
1 changed files with 10 additions and 0 deletions
|
@ -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//\%/%%}"
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue