1
0
mirror of https://github.com/bertptrs/vimconfig.git synced 2025-12-25 20:40:32 +01:00

Handle python virtualenv in prompt.

This commit is contained in:
2018-09-10 14:07:12 +02:00
parent 5edc0862b9
commit e3dee2dc67

View File

@@ -12,6 +12,12 @@ function prompt_last_cmd() {
fi
}
function prompt_handle_virtualenv() {
if [[ -n $VIRTUAL_ENV ]]; then
echo "%{$fg_bold[green]%}🐍 $(basename $VIRTUAL_ENV)%b%f%k "
fi
}
function prompt_ps1() {
local ps1 rs='%b%f%k'
local dir="%{$fg[%~]%}%8~$rs"
@@ -24,6 +30,7 @@ function prompt_ps1() {
"$hist"
"$dir"
$'\n'
'$(prompt_handle_virtualenv)'
"$prompt"
)
echo "${(j::)ps1}"
@@ -42,3 +49,6 @@ function prompt_rprompt() {
PS1="$(prompt_ps1)"
RPROMPT="$(prompt_rprompt)"
# We handle virtualenv ourselves, no need to do it twice.
export VIRTUAL_ENV_DISABLE_PROMPT=1