sorin-ionescu / prezto

The configuration framework for Zsh
MIT License
13.98k stars 4.49k forks source link

Include Homebrew completion path #2076

Closed vboginskey closed 6 months ago

vboginskey commented 7 months ago

Proposed Changes

This PR adds the Homebrew completion directory to fpath to enable Zsh to automatically pick up completions from Homebrew-installed packages.

vboginskey commented 6 months ago

@indrajitr thoughts?

indrajitr commented 6 months ago

@vboginskey, apologies for the delayed response.

There are a few things to consider here:

  1. Zsh fpath is not necessarily about completion functions only. They are also about other Zsh internal functions and helpers.
  2. So even if we have to inject additional fpath members, they have to be at a more generalized place and they have to be customizable (which would be typically in $ZDOTDIR/zprofile).
  3. That said, site function directories are supposed to go hand in hand with the actual Zsh instance being used - so that stock Zsh functions and helpers are consistent with the Zsh instance being used.

Summary:

You have two options from here:

  1. Explicitly add Homebrew zsh package function paths (/opt/homebrew/share/zsh/site-functions and /opt/homebrew/Cellar/zsh/5.9/share/zsh/functions in your $fpath) in your $ZDOTDIR/zprofile and brace for some inconsistencies with built-in Zsh functions.
  2. Switch your default Zsh shell to use Homebrew Zsh (from /opt/homebrew/bin/zsh) instead of macOS native Zsh (from /bin/zsh).
vboginskey commented 6 months ago

That all makes sense, thank you for the detailed response 🙏 .