Force virtualenv prompt change with pyenv-virtualenv
# Force prompt update with pyenv-virtualenv
# see: https://github.com/pyenv/pyenv-virtualenv/issues/135
function virtualenv_prompt {
WANTED_PROMPT="(${VIRTUAL_ENV##*/}) $ORIGINAL_PROMPT"
# Current virtualenv
if [[ $VIRTUAL_ENV != "" ]] && [[ $PS1 != $WANTED_PROMPT ]]; then
PROMPT=$WANTED_PROMPT
else
PROMPT=$ORIGINAL_PROMPT
fi
PS1="$PROMPT"
}
export -f virtualenv_prompt
# Bash shell executes this function just before displaying the PS1 variable
export PROMPT_COMMAND='virtualenv_prompt'