Skip to content

Instantly share code, notes, and snippets.

@stolsma
Forked from jamiew/pimp_prompt.sh
Created September 27, 2011 07:08
Show Gist options
  • Save stolsma/1244504 to your computer and use it in GitHub Desktop.
Save stolsma/1244504 to your computer and use it in GitHub Desktop.
Put this in your ~/.bash_profile or ~/.bashrc file. Then type source ~/.bashrc or source ~/.bash_profile to reload.
parse_git_branch() {
ref=$(git symbolic-ref -q HEAD 2> /dev/null) || return
printf "${1:-(%s)}" "${ref#refs/heads/}"
}
pimp_prompt() {
local BLUE="\[\033[0;34m\]"
local BLUE_BOLD="\[\033[1;34m\]"
local RED="\[\033[0;31m\]"
local LIGHT_RED="\[\033[1;31m\]"
local GREEN="\[\033[0;32m\]"
local LIGHT_GREEN="\[\033[1;32m\]"
local WHITE="\[\033[0;37m\]"
local WHITE_BOLD="\[\033[1;37m\]"
local LIGHT_GRAY="\[\033[0;37m\]"
local STANDARD="\[\033[0;39m\]"
case $TERM in
xterm*)
TITLEBAR='\[\033]0;\u@\h:\w\007\]'
;;
*)
TITLEBAR=""
;;
esac
PS1="${TITLEBAR}[$STANDARD\u@$BLUE_BOLD\h$STANDARD \W$GREEN\$(parse_git_branch)$STANDARD]\$ "
PS2='> '
PS4='+ '
}
pimp_prompt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment