Skip to content

Instantly share code, notes, and snippets.

@cocoanton
Forked from kbsali/partial.bash_rc
Last active August 29, 2015 14:06
Show Gist options
  • Save cocoanton/0451085e8e9facf58d9a to your computer and use it in GitHub Desktop.
Save cocoanton/0451085e8e9facf58d9a to your computer and use it in GitHub Desktop.
export PATH="/usr/local/opt/ruby/bin:$PATH"
export PATH=/usr/local/bin:$PATH
export PATH="$HOME/bin:$PATH"
export PATH=/usr/local/sbin:$PATH
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/:([\1$(parse_git_status)])/"
}
parse_git_status () {
status=$(git status --porcelain 2> /dev/null)
rc=$?
if [[ $rc == 0 && $status ]]; then
echo -e "\033[0;31m\*\033[0;36m"
fi;
}
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color) color_prompt=yes;;
esac
force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
color_prompt=yes
else
color_prompt=
fi
fi
PS1='\[\033[01;37m\]\u@\h\[\033[00m\]:\[\033[00;37m\]\w\[\033[00;36m\]$(parse_git_branch)\[\033[00m\]\$ '
unset color_prompt force_color_prompt
alias ls='ls -FG'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment