Skip to content

Instantly share code, notes, and snippets.

@lbonn
Created October 24, 2016 12:40
Show Gist options
  • Save lbonn/b7f9b7f19796f121e03b0ec3606e15a6 to your computer and use it in GitHub Desktop.
Save lbonn/b7f9b7f19796f121e03b0ec3606e15a6 to your computer and use it in GitHub Desktop.
ubuntu git+virtualenv prompt
GIT_PROMPT_SH="/usr/lib/git-core/git-sh-prompt"
if [ -f ${GIT_PROMPT_SH} ] && [ "$color_prompt" = yes ]; then
GIT_PS1_SHOWCOLORHINTS=1
GIT_PS1_SHOWDIRTYSTATE=1
GIT_PS1_SHOWUPSTREAM=auto
. ${GIT_PROMPT_SH}
PROMPT_COMMAND='__git_ps1 "${debian_chroot:+($debian_chroot)}${VIRTUAL_ENV:+($(basename $VIRTUAL_ENV))}\[\033[01;32m\]\u\[\033[00m\]@\[\033[01;35m\\]\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]" "\\\$ "'
elif [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}${VIRTUAL_ENV:+($(basename $VIRTUAL_ENV))}\[\033[01;32m\]\u\[\033[00m\]@\[\033[01;35m\]\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$(__git_ps1)\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment