Skip to content

Instantly share code, notes, and snippets.

@olivierlacan
Forked from kyanny/gist:1668822
Created August 6, 2012 22:12
Show Gist options
  • Save olivierlacan/3278913 to your computer and use it in GitHub Desktop.
Save olivierlacan/3278913 to your computer and use it in GitHub Desktop.
bashrc prompt git && rbenv
# rbenv
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
source ~/.rbenv/completions/rbenv.bash
# prompt with ruby version
# rbenv version | sed -e 's/ .*//'
__rbenv_ps1 ()
{
rbenv_ruby_version=`rbenv version | sed -e 's/ .*//'`
printf $rbenv_ruby_version
}
# prompt with git && rbenv
if [ -f $BASH_COMPLETION_DIR/git ] && [ -f `which rbenv` ]; then
export PS1='\[\033[01;32m\]\u@\h\[\033[01;33m\] \w$(__git_ps1) ruby=$(__rbenv_ps1) \n\[\033[01;34m\]\$\[\033[00m\] '
elif [ -f $BASH_COMPLETION_DIR/git ]; then
export PS1='\[\033[01;32m\]\u@\h\[\033[01;33m\] \w$(__git_ps1) \n\[\033[01;34m\]\$\[\033[00m\] '
elif [ `which rbenv` ]; then
export PS1='\[\033[01;32m\]\u@\h\[\033[01;33m\] \w ruby=$(__rbenv_ps1) \n\[\033[01;34m\]\$\[\033[00m\] '
else
export PS1='\[\033[01;32m\]\u@\h\[\033[01;33m\] \w \n\[\033[01;34m\]\$\[\033[00m\] '
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment