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

# ── Homebrew ──────────────────────────────────────────────────────
eval "$(/opt/homebrew/bin/brew shellenv)"
export HOMEBREW_AUTOREMOVE=1
export HOMEBREW_CLEANUP_PERIODIC_FULL_DAYS=7

# ── Zinit Plugin Manager ─────────────────────────────────────────
ZINIT_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/zinit/zinit.git"
source "${ZINIT_HOME}/zinit.zsh"

zinit light zsh-users/zsh-autosuggestions
zinit light zsh-users/zsh-syntax-highlighting

# ── Tab accepts autosuggestion or falls back to completion ────
_accept_or_complete() {
  if [[ -n "$POSTDISPLAY" ]]; then
    zle autosuggest-accept
  else
    zle expand-or-complete
  fi
}
zle -N _accept_or_complete
bindkey '\t' _accept_or_complete

# ── Starship Prompt ───────────────────────────────────────────────
eval "$(starship init zsh)"

# ── mise (runtime version manager) ───────────────────────────────
eval "$(mise activate zsh)"

# ── zoxide (smart cd) ────────────────────────────────────────────
eval "$(zoxide init zsh)"

# ── fzf (fuzzy finder: CTRL-R history, CTRL-T files, ALT-C dirs)
source <(fzf --zsh)

# ── Aliases ───────────────────────────────────────────────────────
alias ls="eza --icons --group-directories-first"
alias ll="eza --icons --group-directories-first -la"
alias lt="eza --icons --tree --level=2"
alias cat="bat --paging=never"
alias find="fd"
alias grep="rg"
alias update-all="topgrade"

# ── History ───────────────────────────────────────────────────────
HISTSIZE=50000
SAVEHIST=50000
HISTFILE=~/.zsh_history
setopt SHARE_HISTORY
setopt HIST_IGNORE_DUPS
setopt HIST_IGNORE_SPACE
