# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
  source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi

# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename '/home/trianta/.zshrc'

autoload -Uz compinit

compinit
# End of lines added by compinstall
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'


# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh

# Alias
alias -g vi="nvim"
alias -g vim="nvim"
alias -g cmakeg="cmake -B build -S ."
alias -g cmakeb="cmake --build build -j $(nproc)"
alias -g pcore="taskset -c 1-7"
alias -g a="notify"
alias -g af="taskset -c 0-19 notify"

# Plugins from AUR
source /usr/share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source /usr/share/zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh

# Enable color support
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias l='ls -la --color -h --group-directories-first'
    alias ls='ls --color -h --group-directories-first'
    alias dir='dir --color=auto'
    alias vdir='vdir --color=auto'
    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
fi

# Hyprland login
alias hy='Hyprland'

# Export ~/.config path
export XDG_CONFIG_HOME="$HOME/.config"

# Created by `pipx` on 2023-10-16 08:33:15
export PATH="$PATH:/home/trianta/.local/bin"

# Little neat settings
set colored-stats On
set completion-ignore-case On
set completion-prefix-display-length 3
set mark-symlinked-directories On
set show-all-if-ambiguous On
set show-all-if-unmodified On
set visible-stats On

# Keyboard binds 
bindkey ";2D" beginning-of-line
bindkey ";2C" end-of-line
bindkey ";3D" backward-word
bindkey ";3C" forward-word
bindkey ";5D" backward-word
bindkey ";5C" forward-word
bindkey "^H" backward-word
bindkey "^L" forward-word
bindkey "^[[H" beginning-of-line
bindkey "^[[F" end-of-line
bindkey "^[[3~" delete-char

# ZSH plugin binds
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
bindkey '^K' history-substring-search-up
bindkey '^J' history-substring-search-down

# Set default editor
export EDITOR="nvim"

# Global CMake clangd fix
export CMAKE_EXPORT_COMPILE_COMMANDS=1