zmodule add homebrew completion with if condition #477
-
According to homebrew so adding in .zimrc ...
zmodule /opt/homebrew/share/zsh --fpath site-functions
zmodule completion
... works like a charm. But NOT this: zmodule $(brew --prefix)/share/zsh --fpath site-functions
# zimfw says : no matches found: $(brew --prefix)/share/zsh And NOT even this with a if condition: if type brew &>/dev/null && [[ $(uname) == Darwin ]] ; then zmodule /opt/homebrew/share/zsh --fpath site-functions ; fi
# not working any suggestions? thanks EDIT: i wanted to add a if condition because my .zimrc is shared with a bunch of linux machines. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
You need to set Homebrew's environment variables before trying what you shared above: eval "$(/opt/homebrew/bin/brew shellenv)" I personally have this in my (source: Homebrew installation script, which explicitly prompts the user to add this line to |
Beta Was this translation helpful? Give feedback.
-
@antoineco thanks, that will export HOMEBREW_PREFIX, so i can use it within .zimrc, that's wonderful. what about the if condition. |
Beta Was this translation helpful? Give feedback.
-
finally i come up with a clean and arbitrary if condition without adding the eval to # in ~/.zimrc
if [[ -d /opt/homebrew/share/zsh ]] && [[ $(uname) == Darwin ]] ; then
zmodule /opt/homebrew/share/zsh --fpath site-functions
fi
# but before
zmodule completion |
Beta Was this translation helpful? Give feedback.
-
thanks, we can also test |
Beta Was this translation helpful? Give feedback.
finally i come up with a clean and arbitrary if condition without adding the eval to
.zprofile
: