Created
August 3, 2012 04:03
-
-
Save inlinestyle/3244214 to your computer and use it in GitHub Desktop.
A sweet PS1 for displaying git state and virtualenv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
red="\[\e[0;31m\]" | |
green="\[\e[0;32m\]" | |
yellow="\[\e[0;33m\]" | |
purple="\[\e[0;35m\]" | |
cyan="\[\e[0;36m\]" | |
end="\[\e[0m\]" | |
GIT_PS1_SHOWUPSTREAM=auto | |
GIT_PS1_SHOWSTASHSTATE=true | |
GIT_PS1_SHOWDIRTYSTATE=true | |
VIRTUAL_ENV_DISABLE_PROMPT=true | |
display_virtualenv () { | |
[ ${VIRTUAL_ENV} ] && echo `basename ${VIRTUAL_ENV}` | |
} | |
display_cool_pipe () { | |
if [[ $(__gitdir) && ${VIRTUAL_ENV} ]] | |
then | |
echo "|" | |
fi | |
} | |
export PS1="${cyan}\w @ \@${end} ${purple}(${end}${yellow}\$(display_virtualenv)${end}${purple}\$(display_cool_pipe)${end}${yellow}\$(__git_ps1 "%s")${end}${purple})${end}\n${purple}-> ${end}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The PS1 looks super awkward because I have to escape the function calls, which would escape any color formatting that they would return