Skip to content

Instantly share code, notes, and snippets.

@cocoatomo
Last active July 27, 2019 11:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cocoatomo/9361663df1930991d529e41a617fa524 to your computer and use it in GitHub Desktop.
Save cocoatomo/9361663df1930991d529e41a617fa524 to your computer and use it in GitHub Desktop.
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