Use:
- Install menlo font-patch from: https://gist.github.com/qrush/1595572
- Use menlo font for your current terminal theme.
- Add the code below at the end of your .bash_profile
| # Install and use menlo font-patch from: https://gist.github.com/qrush/1595572 | |
| # Setting GIT prompt | |
| b_black=`tput setab 0` | |
| b_red=`tput setab 9` | |
| b_green=`tput setab 2` | |
| b_cyan=`tput setab 14` | |
| b_white=`tput setab 15` | |
| f_black=`tput setaf 0` | |
| f_red=`tput setaf 9` | |
| f_green=`tput setaf 2` | |
| f_cyan=`tput setaf 14` | |
| f_gray=`tput setaf 8` | |
| f_white=`tput setaf 15` | |
| c_clear=`tput sgr0` | |
| branch_color () | |
| { | |
| if git rev-parse --git-dir >/dev/null 2>&1 | |
| then | |
| color="" | |
| if git diff --quiet 2>/dev/null >&2 | |
| then | |
| color=${b_green} | |
| else | |
| color=${b_red} | |
| fi | |
| else | |
| # return 0 | |
| echo -n ${b_white} | |
| fi | |
| echo -n $color | |
| } | |
| parse_git_branch () | |
| { | |
| if git rev-parse --git-dir >/dev/null 2>&1 | |
| then | |
| gitver="⮀⭠["$(git branch 2>/dev/null| sed -n '/^\*/s/^\* //p')"]" | |
| else | |
| return 0 | |
| fi | |
| echo -e $gitver | |
| } | |
| #It's important to escape colors with \[ to indicate the length is 0 | |
| PS1='\n\[${b_cyan}${f_black}\] \u \[${b_white}${f_cyan}\]⮀\[${f_black}\] \W \[${f_white}$(branch_color)\]$(parse_git_branch)\[${b_white}${f_white}\] \[${c_clear}${f_white}\]⮀\[${c_clear}\] ' |
Use: