summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xconfig/zshrc18
1 files changed, 16 insertions, 2 deletions
diff --git a/config/zshrc b/config/zshrc
index f211999..0b22223 100755
--- a/config/zshrc
+++ b/config/zshrc
@@ -12,8 +12,22 @@ bindkey \^U backward-kill-line
# Enable Ctrl-x-e to edit command line
autoload -U edit-command-line
-# completions
-fpath=(/usr/local/share/zsh-completions $fpath)
+# completions. Homebrew keeps them under its own prefix, which differs by
+# machine -- /opt/homebrew on Apple Silicon, /usr/local on Intel -- and formulae
+# install into share/zsh/site-functions, not the share/zsh-completions this
+# hardcoded until 2026-09-21. That path existed on neither Mac, so every
+# brew-installed completion (_brew, _bat, _deno, ...) was silently missing.
+# Probed rather than asked of `brew --prefix`, which would fork on every shell,
+# and done here because compinit below is the only moment fpath is read.
+for _fp in \
+ "${HOMEBREW_PREFIX:-/opt/homebrew}/share/zsh/site-functions" \
+ "${HOMEBREW_PREFIX:-/opt/homebrew}/share/zsh-completions" \
+ /usr/local/share/zsh/site-functions \
+ /usr/local/share/zsh-completions
+do
+ [[ -d "$_fp" ]] && fpath=("$_fp" $fpath)
+done
+unset _fp
# fix delete
bindkey "^[[3~" delete-char