# Enable p10k instant prompt
[[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]] &&
    source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"

# Some variables
PZ_PLUGIN_HOME="$ZDOTDIR/plugins"
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern regexp root line)

# Load the .zsh files
for file in $ZDOTDIR/.*.zsh; do
    [[ $file == $ZDOTDIR/.p10k.zsh ]] || source $file
done

# Initialize PZ
[[ -d $PZ_PLUGIN_HOME/pz ]] ||
    git clone https://github.com/mattmc3/pz.git $PZ_PLUGIN_HOME/pz
source $PZ_PLUGIN_HOME/pz/pz.zsh

# Set p10k prompt
pz prompt romkatv/powerlevel10k

# Source regular plugins
pz source zsh-users/zsh-autosuggestions
pz source zsh-users/zsh-completions

# Source OMZ libs
pz source ohmyzsh/ohmyzsh lib/git
pz source ohmyzsh/ohmyzsh lib/key-bindings

# Source OMZ plugins
pz source ohmyzsh/ohmyzsh plugins/extract
pz source ohmyzsh/ohmyzsh plugins/fzf
pz source ohmyzsh/ohmyzsh plugins/git
pz source ohmyzsh/ohmyzsh plugins/z

# Always source syntax highlighting plugin last
pz source zsh-users/zsh-syntax-highlighting

# Load p10k configuration
[[ -f $ZDOTDIR/.p10k.zsh ]] && source $ZDOTDIR/.p10k.zsh
