From 1ba7380ac5a5f30eb06fbe746686b31f38d9c97a Mon Sep 17 00:00:00 2001 From: Yuhao Qing Date: Tue, 8 Sep 2026 00:41:09 +0800 Subject: [PATCH] perf(completion): let Oh My Zsh own initialization A single completion setup avoids duplicate initialization. Homebrew already exports its prefix during environment setup, so resolving it again adds an unnecessary subprocess. --- .zshrc | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.zshrc b/.zshrc index 757b516..dae1bd4 100644 --- a/.zshrc +++ b/.zshrc @@ -40,13 +40,10 @@ plugins=( fpath+=$ZSH/custom/plugins/zsh-completions/src -if [[ "$OSTYPE" == "darwin"* ]] && command -v brew &> /dev/null; then - FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}" +if [[ "$OSTYPE" == "darwin"* && -n "$HOMEBREW_PREFIX" ]]; then + fpath=("$HOMEBREW_PREFIX/share/zsh/site-functions" ${fpath:#$HOMEBREW_PREFIX/share/zsh/site-functions}) fi -mkdir -p ~/.cache/zsh -autoload -U compinit && compinit -C -d ~/.cache/zsh/.zcompdump - SAVEHIST=50000 cheat() {