Skip to content

Instantly share code, notes, and snippets.

@jackmaney
Created August 11, 2015 14:52
Show Gist options
  • Save jackmaney/1d08614bd32b87addb7f to your computer and use it in GitHub Desktop.
Save jackmaney/1d08614bd32b87addb7f to your computer and use it in GitHub Desktop.
pyenv virtualenv in PS1
export VIRTUAL_ENV_DISABLE_PROMPT=1
pyenv_python_version(){
result=""
if pyenv 2>/dev/null; then
pyenv_version="$(pyenv version-name)";
if [ -n "$pyenv_version" ]; then
result="$pyenv_version";
fi
fi
[[ -n "$result" ]] && echo "($result) "
}
export PS1="\$(pyenv_python_version)\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h\[\033[33;1m\]\w\[\033[m\]$ "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment