# Path
export PATH=$HOME/.local/bin:$PATH

# Bash-like word boundaries
autoload -U select-word-style
select-word-style bash

# Use antigen
source $HOME/.local/share/zsh/antigen.zsh

# Load various plugins
antigen bundle Aloxaf/fzf-tab
antigen bundle clarketm/zsh-completions
antigen bundle git
antigen bundle mattberther/zsh-pyenv
antigen bundle ellie/atuin@v{{ atuin_version }}
antigen bundle pip
antigen bundle pyenv
antigen bundle zimfw/asdf
antigen bundle zsh-users/zsh-syntax-highlighting
antigen bundle zsh-users/zsh-autosuggestions

# Load the powerlevel10k theme
antigen theme romkatv/powerlevel10k

# Apply plugins
antigen apply

# Powerline10k customization
[[ ! -f ~/.local/share/zsh/p10k.zsh ]] || source ~/.local/share/zsh/p10k.zsh

# History file
HISTFILE=$HOME/.zhistory
SAVEHIST=10000
HISTSIZE=10000
setopt appendhistory
setopt inc_append_history

# Tab completion on empty line
zstyle ':completion:*' insert-tab pending

# Ctrl+Left/Right
bindkey "^[[1;5C" forward-word
bindkey "^[[1;5D" backward-word
# Home/End
bindkey '\e[1~' beginning-of-line
bindkey '\e[4~' end-of-line
# Comments should be ignored
setopt interactivecomments

# LS colors if available
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
fi

# Grep colors
if grep -q --color=auto t 2>/dev/null <<<t
then
        alias grep='grep --color=auto'
fi

# The classics
alias ll='ls -l'
alias la='ls -A'
alias l='ls -CF'
alias cp='cp -i'
alias rm='rm -i'
alias mv='mv -i'

# Load Rust environment if it exists
[[ ! -f ~/.cargo/env ]] || source ~/.cargo/env

# Pyenv venv aliases
export PYENV_VIRTUALENV_DISABLE_PROMPT=1
alias mkvirtualenv="pyenv virtualenv"
alias rmvirtualenv="pyenv virtualenv-delete"
alias workon="pyenv activate"

# Various utilities
alias gl="git log --graph --pretty=format:'%C(yellow)%h%Creset%C(cyan)%C(bold)%d%Creset %C(cyan)(%cr)%Creset %C(green)%ce%Creset %s'"
alias cat="batcat -p"