# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh

#turn on comments with # in shell
setopt interactivecomments

### ALIASES

alias startx="ssh-agent startx"

alias zshconfig="vi ~/.zshrc"
alias zshconfig_node="vi ~/.zshrc_node"
alias vimconfig="vi ~/.vimrc"
alias sshconfig="vi ~/.ssh/config"

alias lh="du -ahd1 | sort -h"
#lhs() { for list in $(ls -a | sed 's/\ /\\ /g'); do du -hs $list; done | sort -hr }

wanip() { curl icanhazip.com }
lanip() { ip a | grep $(ip r | grep default | head | cut -d\  -f5) | grep inet | awk '{print $2}' | cut -d"/" -f1 }

alias ix="curl -s -F 'f:1=<-' ix.io"
up () {curl -F "c=@${1:--}" https://ptpb.pw/}

alias vi="vim"
vissh () {vim scp://"$1"/}
alias sudo="sudo "
alias chrome="google-chrome-stable"
chromeapp() { google-chrome-stable --app=$1 }
alias tmux="tmux -2"
bak() { cp "$1" "$1.bak" }
extract() {
   if [ -f $1 ] ; then
       case $1 in
           *.tar.bz2)	tar xvjf $1    ;;
           *.tar.gz)	tar xvzf $1    ;;
	   *.tar.xz)	tar xJf $1     ;;
           *.bz2)	bunzip2 $1     ;;
           *.rar)	unrar x $1     ;;
           *.gz)	gunzip $1      ;;
           *.tar)	tar xvf $1     ;;
           *.tbz2)	tar xvjf $1    ;;
           *.tgz)	tar xvzf $1    ;;
           *.zip)	unzip $1       ;;
           *.Z)		uncompress $1  ;;
           *.7z)	7z x $1        ;;
           *)		echo "Unable to extract '$1'" ;;
       esac
   else
      echo "'$1' is not a valid file"
   fi
}

### EXPORTS
export LANG='fr_FR.UTF-8'
export EDITOR='vim'
export VISUAL='vim'
export BROWSER='google-chrome-stable'
export POWERLINE_CONFIG_COMMAND='powerline-config'
export PAGER='most'
export PATH=${PATH}:~/.gem/ruby/2.4.0/bin

{% include 'by_host/' + ansible_hostname + '/zshrc.j2' ignore missing %}

{% include 'by_os/' + ansible_distribution|lower + '/zshrc.j2' ignore missing %}

### FZF
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh

### ZSHRC NODE
source ~/.zshrc_node

### ZSH PURE
autoload -U zmv
plugins=(git python colored-man-pages colorize sprunge web-search)
export ZSH_COMPDUMP=/tmp/zcompdump-$USER
source $ZSH/oh-my-zsh.sh
source {{ zsh_syntax_highlighting_dir.stdout }}
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=8'
fpath=( "$HOME/.zfunctions" $fpath )
autoload -U promptinit; promptinit
prompt pure
