Last active
          October 6, 2015 00:57 
        
      - 
      
- 
        Save mdigital/2907430 to your computer and use it in GitHub Desktop. 
    .bash_profile including set_title and git prompt
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | function parse_git_dirty { | |
| [[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" | |
| } | |
| parse_git_branch() { | |
| git branch 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/ [\1$(parse_git_dirty)]/" | |
| } | |
| # 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='\n\e[32m\][\A][\[\e[1;32m\]\h\[\e[0;32m\]][\[\e[1;32m\]\w\[\e[0;32m\]]\e[0m\]\e[01;31m\]$(parse_git_branch)\e[0m\]\n\n> ' | |
| function st { title=$1; echo -e "\033];${title}\007"; } | |
| unset color_prompt force_color_prompt | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment