Skip to content

Instantly share code, notes, and snippets.

@houkanshan
Created August 27, 2012 04:01
Show Gist options
  • Save houkanshan/3485400 to your computer and use it in GitHub Desktop.
Save houkanshan/3485400 to your computer and use it in GitHub Desktop.
bash_theme
# colors defined with tput
function parse_git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo "(git:"${ref#refs/heads/}")"
}
# must put \[ and \] around any non-printing escape sequences
# http://mywiki.wooledge.org/BashFAQ/053
export PS1="\[\e[1;34m\][\t]""\[\e[1;32m\]\u""\[\e[0;0m\]@""\[\e[1;32m\]\H""\[\e[0;0m\]:\w\n\[\e""[0;36m\]\$(git_branch)\$""\[\e[0;0m\] "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment