# zsh/.zsh/plugins.zsh
# Minimal plugin bootstrap via zinit. Bumped from antigen in early 2023.
typeset -r ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
if [[ ! -d "$ZINIT_HOME" ]]; then
mkdir -p "$(dirname "$ZINIT_HOME")"
git clone --depth=1 https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME"
fi
source "${ZINIT_HOME}/zinit.zsh"
# Core completion system first.
autoload -Uz compinit && compinit -C
# Syntax highlighting + suggestions + fzf-tab. Turbo-load the non-blocking ones.
zinit wait lucid for \
atinit"zicompinit; zicdreplay" \
zdharma-continuum/fast-syntax-highlighting \
atload"_zsh_autosuggest_start" \
zsh-users/zsh-autosuggestions \
zsh-users/zsh-completions
zinit ice wait"0" lucid
zinit light Aloxaf/fzf-tab
# Directory jumping (zoxide if installed, otherwise built-in `j`)
if command -v zoxide >/dev/null 2>&1; then
eval "$(zoxide init zsh --cmd j)"
fi
# fzf key bindings (installed via brew/apt).
if [[ -f "${HOME}/.fzf.zsh" ]]; then
source "${HOME}/.fzf.zsh"
fi
# fzf-tab: use fzf for completion menus.
zstyle ':fzf-tab:*' fzf-command fzf
zstyle ':fzf-tab:*' switch-group ',' '.'
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'eza -1 --color=always $realpath 2>/dev/null || ls $realpath'
# Prompt: starship if installed.
if command -v starship >/dev/null 2>&1; then
eval "$(starship init zsh)"
fi