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