Skip to content

Instantly share code, notes, and snippets.

@pjb3
Created September 18, 2014 23:11
Show Gist options
  • Save pjb3/d30712e127df3225b6fe to your computer and use it in GitHub Desktop.
Save pjb3/d30712e127df3225b6fe to your computer and use it in GitHub Desktop.
# Enable bash completion for rbenv commands
source ~/.rbenv/completions/rbenv.bash
__rbenv_ps1 ()
{
rbenv_ruby_version=`rbenv version | sed -e 's/ .*//'`
printf $rbenv_ruby_version
}
# Enable bash completion for git commands/branches
source /usr/local/etc/bash_completion
source /usr/local/etc/bash_completion.d/git-completion.bash
# Colors for prompt
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
WHITE="\[\033[1;37m\]"
BLACK="\[\033[0;30m\]"
OFF="\[\033[0m\]"
# Colorized prompt with rbenv version, git branch and current directory
export PS1="$RED\$(__rbenv_ps1) $GREEN\w$YELLOW\$(__git_ps1 "[%s]")$OFF \$ "
@pjb3
Copy link
Author

pjb3 commented Sep 18, 2014

To use this, first run this command:

brew install bash-completion git

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment