#
# ~/.zshrc
#

# Path to your oh-my-zsh installation.
export ZSH="/home/paul/.oh-my-zsh"

# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="robbyrussell"
function powerline_precmd() {
    PS1="$(powerline-shell --shell zsh $?)"
}

function install_powerline_precmd() {
  for s in "${precmd_functions[@]}"; do
    if [ "$s" = "powerline_precmd" ]; then
      return
    fi
  done
  precmd_functions+=(powerline_precmd)
}

if [ "$TERM" != "linux" ]; then
    install_powerline_precmd
fi

# Uncomment the following line to use case-sensitive completion.
CASE_SENSITIVE="false"

# Uncomment the following line to use hyphen-insensitive completion.
# Case-sensitive completion must be off. _ and - will be interchangeable.
HYPHEN_INSENSITIVE="true"

# Uncomment the following line to change how often to auto-update (in days).
export UPDATE_ZSH_DAYS=3

# Uncomment the following line to enable command auto-correction.
ENABLE_CORRECTION="true"

# Uncomment the following line to display red dots whilst waiting for completion.
# Caution: this setting can cause issues with multiline prompts (zsh 5.7.1 and newer seem to work)
# See https://github.com/ohmyzsh/ohmyzsh/issues/5765
COMPLETION_WAITING_DOTS="true"

# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(
    git
    svn
    themes
    command-not-found
    vi-mode
    extract
    # non oh-my-zsh plugins
    zsh-autosuggestions
    zsh-syntax-highlighting
)

source $ZSH/oh-my-zsh.sh

# additional path variables
export PATH=$PATH:~/.local/bin

### ALIAS' ###
#jokes
alias dog='cat'
alias rr='curl -s -L https://raw.githubusercontent.com/keroserene/rickrollrc/master/roll.sh | bash'	#rickroll

#shutdown and reboot
alias sn='shutdown now'
alias rb='reboot'

# navigation
alias ..='cd ..'
alias ...='cd ../..'
alias .3='cd ../../..'
alias .4='cd ../../../..'
alias .5='cd ../../../../..'

#libreoffice
alias writer='libreoffice --writer'
alias calc='libreoffice --calc'
alias impress='libreoffice --impress'

# pacman and pikaur
alias install='sudo pacman -S'
alias uninstall='sudo pacman -Rns'
alias search='sudo pacman -Ss'
alias install-all='sudo pikaur'
alias update='sudo pacman -Syyu'                 	# update only standard pkgs
alias update-all="pikaur -Syu"              		# update standard pkgs and AUR pkgs
alias cleanup='sudo pacman -Rns $(pacman -Qtdq)' 	# remove orphaned packages

# Changing "ls" to "exa"
alias ls='exa --icons -lF --color=always --group-directories-first --git' # my preferred listing
alias la='exa --icons -aF --color=always --group-directories-first --git'  # all files and dirs
alias ll='exa --icons -alF --color=always --group-directories-first --git'  # long format
alias lt='exa --icons -aTF --color=always --group-directories-first --git' # tree listing
alias lx='exa --icons -lF --color=always --group-directories-first --git --extended' # extended info
alias l.='exa -a | egrep "^\."' # list dotfiles


# Colorize grep output (good for log files)
alias grep='grep --color=auto'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'

# confirm before overwriting something
alias cp="cp -i"
alias mv='mv -i'
alias rm='rm -i'

# git
alias add='git add'
alias addup='git add -u'
alias addall='git add .'
alias branch='git branch'
alias checkout='git checkout'
alias co='git checkout'
alias clone='git clone'
alias commit='git commit -m'
alias fetch='git fetch'
alias pull='git pull origin'
alias push='git push origin'
alias status='git status'
alias diff='git diff'
alias remote='git remote'
alias ftemplate='git fetch template'
alias mtemplate='git merge template/master --allow-unrelated-histories'
alias log='git log'

### AUTOSTART ###

#neofetch
neofetch

