Created
August 14, 2012 04:42
-
-
Save jstirk/3346307 to your computer and use it in GitHub Desktop.
.bashrc example with branch and RVM info
This file contains 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
# 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