補完コマンドのあるディレクトリを FPATH に追加する

~/.zshenv

FPATH=$(brew --prefix)/share/zsh/site-functions/:$FPATH
fpath=($(brew --prefix)/share/zsh/site-functions/(N-/) $fpath)

zinitの場合

  • as'completion' 補完modifier
  • has'<command>' コマンドが存在する場合
# https://github.com/BurntSushi/ripgrep
zinit ice lucid as'completion' blockf has'rg'
zinit snippet /opt/homebrew/share/zsh/site-functions/_rg
 
# https://github.com/sharkdp/fd
zinit ice lucid as'completion' blockf has'fd'
zinit snippet /opt/homebrew/share/zsh/site-functions/_fd