smourph
6/4/2016 - 4:52 PM

Change PS1 prompt + add git branch

Change PS1 prompt + add git branch

# Git branch in prompt.
BLACK="\[$(tput setaf 0)\]"
RED="\[$(tput setaf 1)\]"
GREEN="\[$(tput setaf 2)\]"
DARK_BLUE="\[$(tput setaf 4)\]"
PURPLE="\[$(tput setaf 5)\]"
LIGHT_BLUE="\[$(tput setaf 6)\]"
LIGHT_GREY="\[$(tput setaf 7)\]"
DARK_GREY="\[$(tput setaf 8)\]"
RESET="\[$(tput sgr0)\]"

parse_git_branch() {
    git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
export PS1="[\A] \u:\w${GREEN}\$(parse_git_branch)${RESET}$ "