Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ojacobson
Created April 10, 2014 23:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ojacobson/10430925 to your computer and use it in GitHub Desktop.
Save ojacobson/10430925 to your computer and use it in GitHub Desktop.
. /usr/local/git/contrib/completion/git-completion.bash
. /usr/local/git/contrib/completion/git-prompt.sh
GIT_PS1_SHOWDIRTYSTATE=true
GIT_PS1_SHOWUNTRACKEDFILES=true
ps1_status() {
if [ $? -ne 0 ]; then
echo ":("
else
echo ":)"
fi
}
function configure_prompt() {
local PS_RESET="\[\e[00m\]"
local PS_RED="\[\e[01;31m\]"
local PS_GREEN="\[\e[01;32m\]"
local PS_BLUE="\[\e[01;34m\]"
local PS_PURPLE="\[\e[01;35m\]"
# No \[ \] - makes it too hard to verify the pairing to put them here.
# See TITLEBAR below.
local PS_TITLE_START="\e]0;"
local PS_TITLE_END="\a"
case $TERM in
xterm*|rxvt)
local TITLEBAR="\[$PS_TITLE_START\u@\h:\W$PS_TITLE_END\]"
;;
*)
local TITLEBAR=''
;;
esac
local IDENT="$PS_GREEN\u@\h$PS_RESET"
local CWD="$PS_BLUE\W$PS_RESET"
local SMILEY="$PS_PURPLE"'$(ps1_status)'"$PS_RESET"
local GITPROMPT="$PS_RED"'$(__git_ps1)'"$PS_RESET"
local PROMPT="$SMILEY$IDENT:$CWD$GITPROMPT\$ "
export PS1="$TITLEBAR$PROMPT"
}
configure_prompt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment