add virtualenv support

This commit is contained in:
tomwei7 2016-12-11 13:01:09 +08:00
parent 26aae6b583
commit c793f60845

View File

@ -35,6 +35,15 @@ ys_hg_prompt_info() {
fi fi
} }
# Virtualenv info
export VIRTUAL_ENV_DISABLE_PROMPT=1
local virtualenv_info='$(virtualenv_prompt_info)'
virtualenv_prompt_info() {
if [ ! -z "${VIRTUAL_ENV}" ] ; then
echo -n " ve:$fg[cyan]$(basename $VIRTUAL_ENV)"
fi
}
local exit_code="%(?,,C:%{$fg[red]%}%?%{$reset_color%})" local exit_code="%(?,,C:%{$fg[red]%}%?%{$reset_color%})"
# Prompt format: # Prompt format:
@ -53,6 +62,7 @@ PROMPT="
%{$fg[green]%}%m \ %{$fg[green]%}%m \
%{$fg[white]%}in \ %{$fg[white]%}in \
%{$terminfo[bold]$fg[yellow]%}%~%{$reset_color%}\ %{$terminfo[bold]$fg[yellow]%}%~%{$reset_color%}\
${virtualenv_info}\
${hg_info}\ ${hg_info}\
${git_info}\ ${git_info}\
\ \