mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-12-18 21:41:57 +00:00
Make virtualenv segment configurable, similar to anaconda.
The virtualenv segment can now be configured using the following Variables: set_default POWERLEVEL9K_VIRTUALENV_LEFT_DELIMITER "(" set_default POWERLEVEL9K_VIRTUALENV_RIGHT_DELIMITER ")" The new defaults are chosen to resemble the standard virtualenv prompt configuration. The variable names are choosen analogous to the anaconda segment. This implements the bhilburn/powerlevel9k#345 pr.
This commit is contained in:
parent
08a26b7045
commit
fdbb830c98
1 changed files with 3 additions and 1 deletions
|
@ -1944,13 +1944,15 @@ prompt_vi_mode() {
|
||||||
# More information on virtualenv (Python):
|
# More information on virtualenv (Python):
|
||||||
# https://virtualenv.pypa.io/en/latest/
|
# https://virtualenv.pypa.io/en/latest/
|
||||||
set_default POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION true
|
set_default POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION true
|
||||||
|
set_default POWERLEVEL9K_VIRTUALENV_LEFT_DELIMITER "("
|
||||||
|
set_default POWERLEVEL9K_VIRTUALENV_RIGHT_DELIMITER ")"
|
||||||
prompt_virtualenv() {
|
prompt_virtualenv() {
|
||||||
[[ -n $VIRTUAL_ENV ]] || return
|
[[ -n $VIRTUAL_ENV ]] || return
|
||||||
local msg=''
|
local msg=''
|
||||||
if [[ $POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION == true ]] && _p9k_python_version; then
|
if [[ $POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION == true ]] && _p9k_python_version; then
|
||||||
msg="$_P9K_RETVAL "
|
msg="$_P9K_RETVAL "
|
||||||
fi
|
fi
|
||||||
msg+=${${VIRTUAL_ENV:t}//\%/%%}
|
msg+="$POWERLEVEL9K_VIRTUALENV_LEFT_DELIMITER${${VIRTUAL_ENV:t}//\%/%%}$POWERLEVEL9K_VIRTUALENV_RIGHT_DELIMITER"
|
||||||
"$1_prompt_segment" "$0" "$2" "blue" "$DEFAULT_COLOR" 'PYTHON_ICON' 0 '' "$msg"
|
"$1_prompt_segment" "$0" "$2" "blue" "$DEFAULT_COLOR" 'PYTHON_ICON' 0 '' "$msg"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue