export ZPLUG_HOME="$HOME/.zsh/zplug"
source "$ZPLUG_HOME/init.zsh"

# 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

zplug romkatv/powerlevel10k, as:theme, depth:1
zplug t413/zsh-background-notify
zplug rimraf/k
zplug tarrasch/zsh-bd
zplug zsh-users/zsh-syntax-highlighting, defer:2
zplug "${HOME}/.zsh", from:local, defer:1
zplug "${HOME}/.zsh/fzf", from:local, if:"command -v fzf"

if ! zplug check --verbose; then
  printf "Install? [y/N]: "
  if read -q; then
    echo; zplug install
  fi
fi

zplug load

autoload -Uz compinit
if [[ -n ~/.zcompdump(#qN.mh+24) ]]; then
  compinit
  touch ~/.zcompdump
else
  compinit -C
fi