286 lines · 8.1 KB
# Bash completion (via Homebrew)
if [ -f `brew --prefix`/etc/bash_completion ]; then
    . `brew --prefix`/etc/bash_completion
fi

# Set the terminal into 256 color mode
export TERM=xterm-256color

# Variables for later
VIRTUALENVWRAPPER_SCRIPT=/usr/local/share/python/virtualenvwrapper.sh
GIT_BASH_COMPLETION_SCRIPT=/usr/local/etc/bash_completion.d/git-completion.bash
BREW_BASH_COMPLETION_SCRIPT=/usr/local/etc/bash_completion.d/brew_bash_completion.sh

# For coloring the prompt
function prompt_func() {

    # Ascii color escape codes
    RED="\[\033[0;31m\]"
    GREEN="\[\033[0;32m\]"
    YELLOW="\[\033[0;33m\]"
    BLUE="\[\033[0;34m\]"
    PURPLE="\[\033[0;35m\]"
    CYAN="\[\033[0;36m\]"
    LIGHT_GREEN="\[\033[1;32m\]"
    WHITE="\[\033[1;37m\]"
    LIGHT_GRAY="\[\033[0;37m\]"
    COLOR_NONE="\[\e[0m\]"

    # 256 color foreground codes follow the following format:
    #SAMPLE_256_COLOR="\[\e[38;05;255m\]"

    # Show Git branch in prompt
    if [ -f $GIT_BASH_COMPLETION_SCRIPT ]; then
        export GIT_PS1_SHOWDIRTYSTATE=true
        export GIT_PS1_SHOWUNTRACKEDFILES=true
        export GIT_PS1_SHOWSTASHSTATE=true
        git_branch=$(__git_ps1 " (%s)")
    fi

    # Show virtualenv in prompt