Commit d7331d43 authored by Maxime Bombar's avatar Maxime Bombar

Affiche lorsqu'on est dans un venv activé

parent 48107687
......@@ -291,9 +291,24 @@ precmd () {
fi
fi
# Enable python venv detection
if [ -n "${VIRTUAL_ENV:-}" ]; then
if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ]; then
if [ -z "${VIRTUAL_ENV_DISABLE_DIRECTORY:-}" ]; then
IFS='/'
read -A D <<< "${VIRTUAL_ENV}"
venv_directory=":${D[-2]}"
fi
venv="(venv$venv_directory)%B%F{red}$prompt_hyphen"
fi
else
unset venv
unset venv_directory
fi
unset IFS
# And, makes it good
PS1="$prompt_line_1$prompt_newline$prompt_line_2%B%F{red}${EXITCODE}%b%F{$prompt_color1}$prompt_hyphen%B%F{white}$prompt_char %b%f%k"
PS1="$prompt_line_1$prompt_newline$prompt_line_2${venv}%B%F{red}${EXITCODE}%b%F{$prompt_color1}$prompt_hyphen%B%F{white}$prompt_char %b%f%k"
PS2="$prompt_line_2$prompt_bbox_to_mbox%B%F{white}%_> %b%f%k"
PS3="$prompt_line_2$prompt_bbox_to_mbox%B%F{white}?# %b%f%k"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment