Skip to content

Instantly share code, notes, and snippets.

@sortega
Created May 21, 2010 14:27
Show Gist options
  • Save sortega/408895 to your computer and use it in GitHub Desktop.
Save sortega/408895 to your computer and use it in GitHub Desktop.
Usage: add . ~/.promptrc to your .bashrc
function git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function git_prompt {
__git_ps1 '%s' | sed -e "s/\(.*\)/\1$(git_dirty):/"
}
function proml {
local BLUE="\[\033[0;34m\]"
local LIGHT_BLUE="\[\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 YELLOW="\[\033[1;33m\]"
local WHITE="\[\033[1;37m\]"
local LIGHT_GRAY="\[\033[0;37m\]"
local NO_COLOR="\[\033[0m\]"
case $TERM in
xterm*)
TITLEBAR='\[\033]0;\u@\h:\w\007\]'
;;
*)
TITLEBAR=""
;;
esac
if [ "`whoami`" = "root" ]; then
PS1="$LIGHT_RED[<<\u>>$YELLOW@\h$LIGHT_RED]\
[$WHITE\$(git_prompt)$LIGHT_BLUE\W$LIGHT_RED]\
$YELLOW\$$NO_COLOR "
else
PS1="$LIGHT_BLUE[$WHITE\u@\h$LIGHT_BLUE]\
[$WHITE\$(git_prompt)$LIGHT_BLUE\W]\
\$$NO_COLOR "
fi
PS2="$WHITE>$NO_COLOR "
PS4="$WHITE+$NO_COLOR "
}
proml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment