Created
January 15, 2010 11:28
-
-
Save flashingpumpkin/277975 to your computer and use it in GitHub Desktop.
This file contains 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
function _bash_git_status(){ | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo " *" | |
} | |
function _bash_git(){ | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ ~\1$(_bash_git_status)/' | |
} | |
function _virtual_env_name(){ | |
[[ $(basename $VIRTUAL_ENV 2>/dev/null) ]] && echo "($(basename $VIRTUAL_ENV))" | |
} | |
function prompt(){ | |
PS1="$(_virtual_env_name)\[\033[1;40;31m\]\u@\h\[\033[00m\]:\[\033[34m\][\W$(_bash_git)]\[\033[00m\]$ " | |
} | |
PROMPT_COMMAND=prompt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment