export EDITOR="subl -w"

if [ -f `brew --prefix`/etc/bash_completion ]; then
  . `brew --prefix`/etc/bash_completion
fi

export PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig
export GIT_PS1_SHOWDIRTYSTATE=true
export GIT_PS1_SHOWSTASHSTATE=true

alias ls='ls -G'  # OS-X SPECIFIC - the -G command in OS-X is for colors, in Linux it's no groups
export LSCOLORS="gxDxFxdxCxExExhbadgxgx"

function cd() {
  if [ $# -gt 0 ]; then
    builtin cd "$*" && ls
  else
    builtin cd && ls
  fi
}

function edit() {
  if [ '(' "$#" -eq 1 ')' -a '(' -d "$1" ')' ]; then
    local PATTERN="$1/*.sublime-project"
    local FILES=($PATTERN)
    if [ -f ${FILES[0]} ]; then
      subl ${FILES[0]}
    else
      subl $@
    fi
  elif [ "$#" -eq 0 ]; then
    edit .
  else
    subl $@
  fi
}

export COLOR_NC='\e[0m' # No Color
export COLOR_WHITE='\e[1;37m'
export COLOR_BLACK='\e[0;30m'
export COLOR_BLUE='\e[0;34m'
export COLOR_LIGHT_BLUE='\e[1;34m'
export COLOR_GREEN='\e[0;32m'
export COLOR_LIGHT_GREEN='\e[1;32m'
export COLOR_CYAN='\e[0;36m'
export COLOR_LIGHT_CYAN='\e[1;36m'
export COLOR_RED='\e[0;31m'
export COLOR_LIGHT_RED='\e[1;31m'
export COLOR_PURPLE='\e[0;35m'
export COLOR_LIGHT_PURPLE='\e[1;35m'
export COLOR_BROWN='\e[0;33m'
export COLOR_YELLOW='\e[1;33m'
export COLOR_LIGHT_YELLOW='\e[0;33m'
export COLOR_GRAY='\e[1;30m'
export COLOR_LIGHT_GRAY='\e[0;37m'

export PS1="\[${COLOR_LIGHT_YELLOW}\]\A\[${COLOR_NC}\] \[${COLOR_LIGHT_GRAY}\]\w\[${COLOR_NC}\]\[${COLOR_LIGHT_CYAN}\]\$(__git_ps1 \" %s\")\[${COLOR_NC}\] "
export PS2='> '
export PS3='#? '
export PS4='+ '