Skip to content

Instantly share code, notes, and snippets.

@jstirk
Created August 14, 2012 04:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jstirk/3346307 to your computer and use it in GitHub Desktop.
Save jstirk/3346307 to your computer and use it in GitHub Desktop.
.bashrc example with branch and RVM info
# Add our current git branch out to our path
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}
format_git_branch() {
parse_git_branch | sed -e 's/\(.*\)/(\1)/'
}
rvm_prompt() {
RVM_INTERPRETER=`~/.rvm/bin/rvm-prompt i`
RVM_VERSION=`~/.rvm/bin/rvm-prompt v`
if [[ ! "$RVM_INTERPRETER" =~ "ruby" ]]; then
echo -n "$RVM_INTERPRETER-$RVM_VERSION"
else
if [[ ! "$RVM_VERSION" =~ "1.8.7" ]]; then
echo -n "$RVM_VERSION"
fi
fi
}
# Standard Prompt for local connection
PS1="\\[\\033[01;34m\\] $PWD\\[\\033[01;33m\\]\$(format_git_branch)\\[\\033[01;34m\\] \\\$\\[\\033[00m\\] "
PS1="\$(rvm_prompt)$PS1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment