Skip to content

Instantly share code, notes, and snippets.

@filp
Created January 8, 2012 05:10
Show Gist options
  • Save filp/1577306 to your computer and use it in GitHub Desktop.
Save filp/1577306 to your computer and use it in GitHub Desktop.
prompt() {
last_status="$?"
color_base="\[\e[0m\]"
color_red_bold="\[\e[1;31m\]"
color_green_bold="\[\e[1;35m\]"
color_yellow_light="\[\e[0;33m\]"
git_branch=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
if [ $last_status -eq "0" ]
then
smiley="${color_green_bold} ☺${color_base} "
else
smiley="${color_red_bold} ☹ ${color_base}"
fi
if [ -z "$git_branch" ]
then
git="";
else
git=" (${color_yellow_light}${git_branch}${color_base})"
fi
PS1="\w${smiley}${git} \$ "
}
PROMPT_COMMAND=prompt
alias ls="ls --color"
alias ll="ls -l"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment