Skip to content

Instantly share code, notes, and snippets.

@levicole
Created September 8, 2015 15:41
Show Gist options
  • Select an option

  • Save levicole/0e97cf7d2fbdfc001f5b to your computer and use it in GitHub Desktop.

Select an option

Save levicole/0e97cf7d2fbdfc001f5b to your computer and use it in GitHub Desktop.
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
export CLICOLOR=1
export LSCOLORS=gxgxcxdxbxegedabagacad
export CLICOLOR LSCOLORS
function parse_git_deleted {
[[ $(git status 2> /dev/null | grep deleted:) != "" ]] && echo "-"
}
function parse_git_added {
[[ $(git status 2> /dev/null | grep "Untracked files:") != "" ]] && echo '+'
}
function parse_git_modified {
[[ $(git status 2> /dev/null | grep modified:) != "" ]] && echo "*"
}
function parse_git_dirty {
echo "$(parse_git_added)$(parse_git_modified)$(parse_git_deleted)"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/<\1$(parse_git_dirty)>/"
}
LONG_PS1="\033[1;35m\]\W\e[0;33m\](\$(rvm-prompt))\033[0;34m\]\$(parse_git_branch)\[\033[00m\] $ "
MEDIUM_PS1='\[\033[1;35m\]\W\[\033[0;34m\]$(parse_git_branch)\[\033[00m\] $ '
SHORT_PS1="$(parse_git_dirty) $ "
export PS1=$MEDIUM_PS1
alias gpr='git pull --rebase'
alias gd='git diff'
alias gdc='git diff --cached'
alias gst='git status'
if [ -f `brew --prefix`/etc/bash_completion ]; then
. `brew --prefix`/etc/bash_completion
fi
@levicole
Copy link
Author

levicole commented Sep 8, 2015

To install:

cat ~/.bash_profile > ~/.bash_profile.old
curl https://gist.github.com/levicole/0e97cf7d2fbdfc001f5b/raw/2d35cdd54454d98959ab568f3dc8a860b2f87ba8/.bash_profile > ~/.bash_profile
curl https://gist.github.com/levicole/0e97cf7d2fbdfc001f5b/raw/2d35cdd54454d98959ab568f3dc8a860b2f87ba8/.bashrc > ~/.bashrc
cat ~/.bash_profile.old >> ~/.bashrc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment