Skip to content

Instantly share code, notes, and snippets.

@jacebennett
Created April 30, 2012 14:56
Show Gist options
  • Save jacebennett/2559006 to your computer and use it in GitHub Desktop.
Save jacebennett/2559006 to your computer and use it in GitHub Desktop.
put this in your bash
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
source /usr/local/Cellar/git/1.7.10/etc/bash_completion.d/git-completion.bash
txtblk='\033[0;30m' # Black - Regular
txtred='\033[0;31m' # Red
txtgrn='\033[0;32m' # Green
txtylw='\033[0;33m' # Yellow
txtblu='\033[0;34m' # Blue
txtpur='\033[0;35m' # Purple
txtcyn='\033[0;36m' # Cyan
txtwht='\033[0;37m' # White
bldblk='\033[1;30m' # Black - Bold
bldred='\033[1;31m' # Red
bldgrn='\033[1;32m' # Green
bldylw='\033[1;33m' # Yellow
bldblu='\033[1;34m' # Blue
bldpur='\033[1;35m' # Purple
bldcyn='\033[1;36m' # Cyan
bldwht='\033[1;37m' # White
unkblk='\033[4;30m' # Black - Underline
undred='\033[4;31m' # Red
undgrn='\033[4;32m' # Green
undylw='\033[4;33m' # Yellow
undblu='\033[4;34m' # Blue
undpur='\033[4;35m' # Purple
undcyn='\033[4;36m' # Cyan
undwht='\033[4;37m' # White
bakblk='\033[40m' # Black - Background
bakred='\033[41m' # Red
badgrn='\033[42m' # Green
bakylw='\033[43m' # Yellow
bakblu='\033[44m' # Blue
bakpur='\033[45m' # Purple
bakcyn='\033[46m' # Cyan
bakwht='\033[47m' # White
txtrst='\033[m' # Text Reset
__vcs_status() {
branch=$(__git_ps1)
if [ $branch ]; then
# not updated
color="${txtgrn}"
status=$(git status 2> /dev/null)
# added to index (yellow)
if $(echo "$status" | grep 'to be committed' &> /dev/null); then
color="${txtylw}"
fi
# if we have untracked files (red)
if $(echo "$status" | grep 'not staged' &> /dev/null); then
color="${txtred}"
fi
echo -e $color $branch $txtrst
else
echo -e " "
fi
}
PS1='\u@\h \W`__vcs_status`\$ '
alias vim="mvim -v"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment