-# Shared Zsh settings
-
-setopt correct extendedglob nocaseglob rcexpandparam nocheckjobs
-setopt numericglobsort nobeep appendhistory histignorealldups autocd prompt_subst
-
HISTFILE="$HOME/.zsh_history"
HISTSIZE=100000
SAVEHIST=100000
+
+setopt correct extendedglob nocaseglob rcexpandparam nocheckjobs
+setopt numericglobsort nobeep appendhistory histignorealldups autocd prompt_subst
setopt share_history hist_ignore_all_dups hist_ignore_space hist_reduce_blanks extended_history
export LS_COLORS='di=34:ln=35:so=32:pi=33:ex=31:bd=34;46:cd=34;43'
-# Completion
-if command -v brew >/dev/null 2>&1; then
- FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}"
+# Add Homebrew completion definitions without launching Homebrew at shell startup.
+if [[ -d /opt/homebrew/share/zsh/site-functions ]]; then
+ FPATH="/opt/homebrew/share/zsh/site-functions:${FPATH}"
+elif [[ -d /usr/local/share/zsh/site-functions ]]; then
+ FPATH="/usr/local/share/zsh/site-functions:${FPATH}"
fi
+
autoload -Uz compinit
+# Rebuild the completion cache only when it is more than 24 hours old.
if [[ -n ~/.zcompdump(#qN.mh+24) ]]; then compinit; else compinit -C; fi
zstyle ':completion:*' menu no
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
zstyle ':completion:*' cache-path "$HOME/.zsh/cache"
setopt complete_in_word auto_menu
-# Prompt
+# dotifles config
+alias cfg='git --git-dir="$HOME/.cfg" --work-tree="$HOME"'
+
+# git prompt info
autoload -Uz vcs_info
precmd_vcs_info() { vcs_info }
precmd_functions+=(precmd_vcs_info)
PROMPT='%F{cyan}%n@%m%f %F{240}%1~%f %F{cyan}❯%f '
RPROMPT='%F{green}${vcs_info_msg_0_} %F{240}%*%f'
+# emacs-style command-line editing.
bindkey -e
+# treat /, &, ., and ; as word boundaries when editing.
WORDCHARS=${WORDCHARS//\/[&.;]}
-# Smart cd; its database remains local to this machine.
+# cd-smart
export CDS_DB="$HOME/.local/state/cd-smart.tsv"
source "$HOME/.zsh/cd-smart.zsh"
alias grep='grep --color'
-alias cfg='git --git-dir="$HOME/.cfg" --work-tree="$HOME"'
+
export PATH="$HOME/bin:$HOME/.local/bin:$PATH"
-# fzf, when installed
+# Load fzf integration only when fzf is installed.
if command -v fzf >/dev/null 2>&1; then
export FZF_CTRL_R_OPTS="--height=~15 --layout=reverse --no-info --no-separator --no-scrollbar --prompt='history › ' --scheme=history --with-nth 2.."
source <(fzf --zsh)
fi
-
-# fzf-tab and optional plugins are loaded by the platform file when available.
+++ /dev/null
-# Copy to ~/.zsh/local.zsh for machine- or work-specific settings.
-# Keep this file out of shared/public dotfiles.
-
-# Examples:
-# AWS configuration is usually best managed in ~/.aws/config.
-# If a machine-wide default is needed, set it here with generic values:
-# export AWS_PROFILE=your-profile
-# export AWS_REGION=your-region
-#
-# Put any other machine-specific paths or environment variables here.
alias ls='ls -G'
alias x86='arch -x86_64 zsh'
-if command -v brew >/dev/null 2>&1; then
- eval "$(brew shellenv)"
- if [[ -r "$(brew --prefix)/opt/fzf-tab/share/fzf-tab/fzf-tab.zsh" ]]; then
- source "$(brew --prefix)/opt/fzf-tab/share/fzf-tab/fzf-tab.zsh"
- [[ -r "$HOME/.zsh/fzf-tab.zsh" ]] && source "$HOME/.zsh/fzf-tab.zsh"
- fi
- [[ -r "$(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh" ]] && \
- source "$(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh"
- [[ -r "$(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" ]] && \
- source "$(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
+# Homebrew is normally installed under /opt/homebrew on Apple Silicon and
+# /usr/local on Intel Macs. Use the known path to avoid repeated `brew --prefix`
+# subprocesses while starting a shell.
+if [[ -x /opt/homebrew/bin/brew ]]; then
+ HOMEBREW_PREFIX=/opt/homebrew
+elif [[ -x /usr/local/bin/brew ]]; then
+ HOMEBREW_PREFIX=/usr/local
+fi
+
+if [[ -n ${HOMEBREW_PREFIX:-} ]]; then
+ # Add Homebrew's tools to the environment without running `brew shellenv`.
+ export PATH="$HOMEBREW_PREFIX/bin:$HOMEBREW_PREFIX/sbin:$PATH"
+ export MANPATH="$HOMEBREW_PREFIX/share/man${MANPATH:+:$MANPATH}"
+ export INFOPATH="$HOMEBREW_PREFIX/share/info${INFOPATH:+:$INFOPATH}"
+
+ [[ -r "$HOMEBREW_PREFIX/opt/fzf-tab/share/fzf-tab/fzf-tab.zsh" ]] && \
+ source "$HOMEBREW_PREFIX/opt/fzf-tab/share/fzf-tab/fzf-tab.zsh"
+ [[ -r "$HOME/.zsh/fzf-tab.zsh" ]] && source "$HOME/.zsh/fzf-tab.zsh"
+ [[ -r "$HOMEBREW_PREFIX/share/zsh-autosuggestions/zsh-autosuggestions.zsh" ]] && \
+ source "$HOMEBREW_PREFIX/share/zsh-autosuggestions/zsh-autosuggestions.zsh"
+ # Syntax highlighting must remain the final plugin loaded.
+ [[ -r "$HOMEBREW_PREFIX/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" ]] && \
+ source "$HOMEBREW_PREFIX/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
fi
[[ -r "$HOME/.docker/init-zsh.sh" ]] && source "$HOME/.docker/init-zsh.sh"