# ~/.zshrc — managed by https://github.com/<you>/dotfiles
# Reproduces my terminal setup on any Linux/macOS box.

# --- Powerlevel10k instant prompt -------------------------------------------
# Keep close to the top. Anything that prints or prompts must go ABOVE this.
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

# --- Oh My Zsh --------------------------------------------------------------
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="powerlevel10k/powerlevel10k"

plugins=(
  git
  kubectl
  zsh-autosuggestions
  sudo
  copypath
  copyfile
  dirhistory
  docker
  docker-compose
  nvm
)

# Only source omz if it's actually installed (lets the file be sourced before install.sh finishes).
[ -s "$ZSH/oh-my-zsh.sh" ] && source "$ZSH/oh-my-zsh.sh"

# --- PATH -------------------------------------------------------------------
export PATH="$HOME/.local/bin:$PATH"

# Homebrew (macOS or Linuxbrew) — only if present.
if [ -x /opt/homebrew/bin/brew ]; then
  eval "$(/opt/homebrew/bin/brew shellenv)"
elif [ -x /home/linuxbrew/.linuxbrew/bin/brew ]; then
  eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
fi

# --- Atuin (shell history) --------------------------------------------------
if [ -f "$HOME/.atuin/bin/env" ]; then
  . "$HOME/.atuin/bin/env"
  command -v atuin >/dev/null && eval "$(atuin init zsh)"
fi

# --- Completions ------------------------------------------------------------
fpath=(~/.zsh/completions $fpath)

# --- Powerlevel10k user config ---------------------------------------------
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh

# --- Local overrides (not checked in) --------------------------------------
# Put machine-specific stuff (API keys, conda init, nvm, etc.) in ~/.zshrc.local.
[ -f "$HOME/.zshrc.local" ] && source "$HOME/.zshrc.local"
