Skip to content

Instantly share code, notes, and snippets.

@edercosta
Created May 5, 2011 00:46
Show Gist options
  • Save edercosta/956327 to your computer and use it in GitHub Desktop.
Save edercosta/956327 to your computer and use it in GitHub Desktop.
rvm - name prompt
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
}
# rvm
# if [[ -s $HOME/.rvm/scripts/rvm ]] ; then source $HOME/.rvm/scripts/rvm ; fi
PS1='\n[\u] \[\033[1;33m\]\w\a\[\033[0m\] \[\033[1;30m\][$(~/.rvm/bin/rvm-prompt)] \[\033[0m\]\[\033[1;32m\]$(parse_git_branch)\[\033[0m\]\n$ '
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment