1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-12-18 02:20:09 +00:00

feat(ys): add virtualenv prompt info (#8453)

This commit is contained in:
MrAureliusR 2021-04-23 09:51:31 -04:00 committed by GitHub
parent b3d1826a43
commit 0e5fed193e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -37,6 +37,15 @@ ys_hg_prompt_info() {
fi fi
} }
# Virtualenv
local venv_info='$(virtenv_prompt)'
YS_THEME_VIRTUALENV_PROMPT_PREFIX=" %{$fg[green]%}"
YS_THEME_VIRTUALENV_PROMPT_SUFFIX=" %{$reset_color%}%"
virtenv_prompt() {
[[ -n ${VIRTUAL_ENV} ]] || return
echo "${YS_THEME_VIRTUALENV_PROMPT_PREFIX}${VIRTUAL_ENV:t}${YS_THEME_VIRTUALENV_PROMPT_SUFFIX}"
}
local exit_code="%(?,,C:%{$fg[red]%}%?%{$reset_color%})" local exit_code="%(?,,C:%{$fg[red]%}%?%{$reset_color%})"
# Prompt format: # Prompt format:
@ -57,6 +66,7 @@ PROMPT="
%{$terminfo[bold]$fg[yellow]%}%~%{$reset_color%}\ %{$terminfo[bold]$fg[yellow]%}%~%{$reset_color%}\
${hg_info}\ ${hg_info}\
${git_info}\ ${git_info}\
${venv_info}\
\ \
%{$fg[white]%}[%*] $exit_code %{$fg[white]%}[%*] $exit_code
%{$terminfo[bold]$fg[red]%}$ %{$reset_color%}" %{$terminfo[bold]$fg[red]%}$ %{$reset_color%}"