export ZSH="$ZDOTDIR/ohmyzsh"

ZSH_THEME="bira"

zstyle ':omz:update' mode auto      # update automatically without asking

# command execution time stamp shown in the history command output.
HIST_STAMPS="dd.mm.yyyy"

plugins=(
  git
  zsh-syntax-highlighting
  zsh-autosuggestions
)

source $ZSH/oh-my-zsh.sh

#######################################################
#
# User configuration
#
#######################################################

#
# Aliases
#
alias pac="doas pacman"
alias sudo="doas "
alias mv="mv -i"
alias ls="ls --color=auto"
alias ll="ls -lAh --color=auto"
alias la="ls -A --color=auto"
alias l="ls -A --color=auto"
alias grep="grep --color=auto"

# Typos
alias al="ls -lAh --color=auto"
alias s=""
alias daos="doas "
alias celar="clear"
alias gti="git"
alias mc="mv -i"

#
# Variables
#
# XDG Base Directories
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_CACHE_HOME="$HOME/.local/cache"
export XDG_STATE_HOME="$HOME/.local/state"
export XDG_DATA_DIRS="/usr/local/share:/usr/share"
export XDG_CONFIG_DIRS="/etc/xdg"

# ~/ Cleanup
export CARGO_HOME="$XDG_DATA_HOME"/cargo
export GNUPGHOME="$XDG_DATA_HOME"/gnupg
export ZDOTDIR="$HOME"/.config/zsh
export _JAVA_OPTIONS=-Djava.util.prefs.userRoot="$XDG_CONFIG_HOME"/java
export GTK2_RC_FILES="$XDG_CONFIG_HOME"/gtk-2.0/gtkrc
export TEXMFVAR="$XDG_CACHE_HOME"/texlive/texmf-var

export PATH="$PATH:$HOME/.local/bin:/sbin"
export GPG_TTY=$(tty)
export XDG_DATA_DIRS="$XDG_DATA_DIRS:/var/lib/flatpak/exports/share"
export XDG_DATA_DIRS="$XDG_DATA_DIRS:$HOME/.local/share/flatpak/exports/share"

#
# Behaviour
#

# Modern completion system
autoload -Uz compinit
compinit -d ~/.cache/zsh/ > /dev/null 2>&1
_comp_options+=(globdots)  # include hidden files

# shell history
HISTFILE=~/.config/zsh/history
HISTSIZE=100000
SAVEHIST=100000

# Search history with Up / Down
bindkey "\e[A" history-beginning-search-backward
bindkey "\e[B" history-beginning-search-forward

setopt hist_ignore_all_dups # remove older duplicate entries from history
setopt hist_reduce_blanks # remove superfluous blanks from history items
setopt inc_append_history # save history entries as soon as they are entered
setopt share_history # share history between different instances of the shell
setopt auto_cd # cd by typing directory name if it's not a command
setopt correct_all # autocorrect commands
setopt auto_list # automatically list choices on ambiguous completion
setopt auto_menu # automatically use menu completion
setopt always_to_end # move cursor to end if word had one match
