Skip to content

Instantly share code, notes, and snippets.

@fengmk2 fengmk2/.bash_profile forked from nesquena/.bash_profile
Last active Dec 26, 2015

Embed
What would you like to do?
fix color on OS X
# COLORS
LIGHT_GRAY="\[\033[0;37m\]"; BLUE="\[\033[1;36m\]"; RED="\[\033[0;31m\]"; LIGHT_RED="\[\033[1;31m\]";
GREEN="\[\033[0;32m\]"; WHITE="\[\033[1;37m\]"; LIGHT_GRAY="\[\033[0;37m\]"; YELLOW="\[\033[1;33m\]";
# GIT PROMPT (http://gist.github.com/120804)
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \(\1\)/';
}
function parse_git_status {
git status 2> /dev/null | grep 'working directory clean' | wc -l;
}
function check_git_changes {
# tput setaf 1 = RED, tput setaf 2 = GREEN
[ `parse_git_status` -eq 1 ] && tput setaf 2 || tput setaf 1;
}
export PS1="${debian_chroot:+($debian_chroot)}$BLUE\u@$YELLOW\w\[\$(check_git_changes)\]\$(parse_git_branch)$LIGHT_GRAY $ "
@fengmk2

This comment has been minimized.

Copy link
Owner Author

fengmk2 commented Oct 23, 2013

working git location:
1

clean dir:

2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.