Skip to content

Instantly share code, notes, and snippets.

@cocoatomo

cocoatomo/venv_git_ps1.sh

Last active Jul 27, 2019
Embed
What would you like to do?
git-prompt.sh + venv
# prompt
## wget https://raw.github.com/git/git/master/contrib/completion/git-prompt.sh -O "${HOME}/.local/share/git-prompt.sh"
if [ -f "${HOME}/.local/share/git-prompt.sh" ]; then
source "${HOME}/.local/share/git-prompt.sh"
fi
PROMPT_COMMAND='venv_git_ps1 "[\u@\h \W]" "\\\$ "'
GIT_PS1_SHOWDIRTYSTATE=true
GIT_PS1_SHOWCOLORHINTS=true
GIT_PS1_SHOWSTASHSTATE=true
GIT_PS1_SHOWUNTRACKEDFILES=true
# GIT_PS1_STATESEPARATOR=/
GIT_PS1_SHOWUPSTREAM=auto
venv_git_ps1 () {
if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-} " ] || [ -z "$VIRTUAL_ENV" ]; then
__git_ps1 "$@"
return $?
else
__git_ps1 "$@"
PS1="(`basename \"$VIRTUAL_ENV\"`) $PS1"
return $?
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment