Skip to content

Instantly share code, notes, and snippets.

@vagmi
Created October 11, 2010 16:01
Show Gist options
  • Save vagmi/620762 to your computer and use it in GitHub Desktop.
Save vagmi/620762 to your computer and use it in GitHub Desktop.
# Add these functions to your .profile to know the git branch, ruby version
# and the rvm gemset that you are currently using
function bash_git_branch
{
git branch 2> /dev/null | grep \* | python -c "print '['+raw_input()[2:]+']'" 2> /dev/null
}
function ruby_version
{
ruby -v 2> /dev/null | awk '{ print $2}'
}
function rvm_gemset
{
rvm gemset name 2> /dev/null|awk '{if ($0=="") print ""; else print "@" $0 }' 2> /dev/null
}
# you can turbocharge your command prompt to display them.
export PS1="\u@\h \w\$(bash_git_branch) r(\$(ruby_version)\$(rvm_gemset)) \$ "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment