ZSH=$HOME/.ohmyzsh
DOTCONFDIR=$HOME/.dotconfigs

URL_OMZSH="https://github.com/robbyrussell/oh-my-zsh.git"

### Install oh-my-zsh

if [[ ! -d $ZSH ]]; then
    if curl --output /dev/null --silent -m 1  --head --fail "$URL_OMZSH"; then
	      echo "Installing Oh My ZSH"
	      git clone "$URL_OMZSH" $ZSH
    fi
fi


### Configure oh-my-zsh

ZSH_THEME="pygmalion"

plugins=(
    git
    pip
    docker-compose
    python
    virtualenvwrapper
)

source $ZSH/oh-my-zsh.sh


### Configure zsh

HISTSIZE=20000
HISTFILE=~/.zsh_history
SAVEHIST=$HISTSIZE
# hosts=(${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) /dev/null)"}%%[# ]*}//,/ })


### Generic Setup
export LC_ALL='en_US.UTF-8'
export WORKON_HOME=~/.virtualenvs

if [[ $(uname) = "Darwin" ]]; then
    PATH=$PATH:~/Library/Anaconda/bin
fi

source $DOTCONFDIR/dotconf.sh


# Alias configuration


if [[ $(uname) = "Linux" ]]; then
    alias em='emacs -nw'
    alias ec='emacsclient -c'
    alias grep='grep --color'
    alias ls='ls --color'
    alias l='ls -lh --color'
    alias open='xdg-open'
fi

if [[ $(uname) = "Darwin" ]]; then
    PATH=$PATH:~/Library/Anaconda/bin
    alias emacs='/usr/local/opt/emacs/bin/emacs'
    alias em='emacs -nw'
    alias ec='/usr/local/opt/emacs/bin/emacsclient -c'
    alias grep='grep --color=always'
    alias l='ls -lh'
fi
