274 lines · 7.8 KB
# 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

# 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\]"

    # 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
    if [ -f $VIRTUALENVWRAPPER_SCRIPT ]; then
        if [ "$(showvirtualenv)" == 'showvirtualenv [env]' ]; then
            virtualenv=""
        else
            virtualenv="($(showvirtualenv)) "
        fi
    fi

	#prompt="${YELLOW}${virtualenv}${CYAN}\h:${RED}\w${CYAN} \u${RED}${YELLOW}${git_branch}${CYAN}${COLOR_NONE}"