Skip to content

Instantly share code, notes, and snippets.

@charz
Created March 4, 2014 08:20
Show Gist options
  • Save charz/9342320 to your computer and use it in GitHub Desktop.
Save charz/9342320 to your computer and use it in GitHub Desktop.
My console prompt
# add git prompt, charles
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
function proml {
local BLUE="\[\033[0;34m\]"
local LBLUE="\[\033[1;34m\]"
local RED="\[\033[0;31m\]"
local LRED="\[\033[1;31m\]"
local GREEN="\[\033[0;32m\]"
local LGREEN="\[\033[1;32m\]"
local WHITE="\[\033[1;37m\]"
local LGRAY="\[\033[0;37m\]"
local YELLOW="\[\033[0;33m\]"
local LYELLOW="\[\033[1;33m\]"
case $TERM in
xterm*)
TITLEBAR='\[\033]0;\u@\h:\w\007\]'
;;
*)
TITLEBAR=""
;;
esac
PS1="${TITLEBAR}\
$LGRAY[$LRED\$(date +%H:%M)$LGRAY]\
$LGRAY[$LYELLOW\u@\h: $LBLUE\w $LGREEN\$(parse_git_branch)$LGRAY]\
$WHITE \$ $LGRAY"
PS2='> '
PS4='+ '
}
proml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment