-
-
Save jacqui/1482565 to your computer and use it in GitHub Desktop.
Display current rvm gemset and git branch in your prompt (bash).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Adapted from: http://ariejan.net/2010/04/25/ruby-version-and-gemset-in-your-bash-prompt-yes-sir | |
function rvm_version { | |
local gemset=$(echo $GEM_HOME | awk -F'@' '{print $2}') | |
[ "$gemset" != "" ] && echo "@$gemset" | |
} | |
# https://github.com/git/git/blob/master/contrib/completion/git-completion.bash | |
# defines '__git_ps1' current git branch function | |
source ~/.git-completion.bash | |
export PS1="\$(rvm_version) \$(__git_ps1 '(%s)') \$ " |
And, with colors!
function rvm_version {
local gemset=$(echo $GEM_HOME | awk -F'@' '{print $2}')
[ "$gemset" != "" ] && echo "@$gemset"
}
export PS1='\[\033[1;34m\]$(rvm_version)\[\033[0m\] \W$(__git_ps1 "\[\033[1;32m\](%s)\[\033[0m\]") \$ '
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
looks like:
@olympics_2012 (feature/parse_some_xml) $