Skip to content

Instantly share code, notes, and snippets.

@scottrabin
Last active August 29, 2015 14:00
Show Gist options
  • Save scottrabin/43ea032cb8065f59bf9a to your computer and use it in GitHub Desktop.
Save scottrabin/43ea032cb8065f59bf9a to your computer and use it in GitHub Desktop.
.bash_profile
export PATH="$HOME/bin:$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
export PROMPT_COMMAND=__prompt_command
__prompt_command () {
local EXIT="$?"
local RED=$(tput setaf 1)
local GREEN=$(tput setaf 2)
local ORANGE=$(tput setaf 3)
local CYAN=$(tput setaf 6)
local RESET=$(tput sgr0)
local PROMPT="\[$RED\]:("
if [ $EXIT == 0 ]; then
PROMPT="\[$GREEN\]:)"
fi
local GIT_BRANCH_COLOR="$ORANGE"
if git diff --quiet 2>/dev/null >&2; then
GIT_BRANCH_COLOR="$GREEN"
fi
PS1="\[$RESET\]\[$GREEN\]\u \[$CYAN\]\w \[$GIT_BRANCH_COLOR\]\$(__git_ps1 '(%s)')\[$RESET\]\n$PROMPT \[$RESET\]"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment