Skip to content

Instantly share code, notes, and snippets.

@idris
Created October 12, 2010 16:25
Show Gist options
  • Select an option

  • Save idris/622471 to your computer and use it in GitHub Desktop.

Select an option

Save idris/622471 to your computer and use it in GitHub Desktop.
function parse_git_branch {
local branch=`git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
if [ "$branch" == "" ]
then
echo ""
else
echo \($branch\)\
fi
}
function get_random_num {
echo $[($RANDOM % 6) + 1]
}
#if [ "\$(type -t __git_ps1)" ]; then
# PS1="\$(__git_ps1 '(%s) ')$PS1"
#fi
function proml {
local BLUE="\[\033[0;34m\]"
local RED="\[\033[0;31m\]"
local LIGHT_RED="\[\033[0;31m\]"
local GREEN="\[\033[0;32m\]"
local LIGHT_GREEN="\[\033[1;32m\]"
local WHITE="\[\033[1;37m\]"
local LIGHT_GRAY="\[\033[0;37m\]"
local LIGHT_BLUE="\[\033[0;34m\]"
local RESET="\[\033[0m\]"
case $TERM in
xterm*)
TITLEBAR='\[\033]0;\u@\h:\w\007\]'
;;
*)
TITLEBAR=""
;;
esac
PS1="\[\033[0;3\$(get_random_num)m\]\$(parse_git_branch)\[\033[0;3\$(get_random_num)m\]${TITLEBAR}\
\w\[\033[0;3\$(get_random_num)m\]\$ \
$RESET"
PS2='> '
PS4='+ '
}
proml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment