Skip to content

Instantly share code, notes, and snippets.

@ctide
Created November 6, 2011 19:44
Show Gist options
  • Save ctide/1343369 to your computer and use it in GitHub Desktop.
Save ctide/1343369 to your computer and use it in GitHub Desktop.
function parse_git_branch_and_add_brackets {
/usr/bin/git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\ \[\1\]/'
}
NM="\[\033[0;38m\]" #means no background and white lines
HI="\[\033[0;37m\]" #change this for letter colors
HII="\[\033[0;31m\]" #change this for letter colors
HIB="\[\033[0;32m\]" #change this for bg colors
SI="\[\033[0;33m\]" #this is for the current directory
IN="\[\033[0m\]"
export PS1="$NM[$HI\u@$HII\h $SI\w$NM]$HIB\$(parse_git_branch_and_add_brackets)$IN:~\$ "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment