From f6774a6a130da9ce4c345976d60ea5d4feb07343 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Thu, 1 Jun 2023 10:27:12 -0700 Subject: [PATCH] [zsh] Add homebrew site-functions to fpath --- zsh/func/init_rc_configure_completion | 2 +- zsh/func/init_rc_fpath_darwin | 17 +++++++++++++++++ zshrc | 1 + 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 zsh/func/init_rc_fpath_darwin diff --git a/zsh/func/init_rc_configure_completion b/zsh/func/init_rc_configure_completion index c3f86e5..5b378fa 100644 --- a/zsh/func/init_rc_configure_completion +++ b/zsh/func/init_rc_configure_completion @@ -1,7 +1,7 @@ #!/usr/bin/env zsh # Eryn Wells -autoload -U compinit +autoload -Uz compinit compinit # Cache completions diff --git a/zsh/func/init_rc_fpath_darwin b/zsh/func/init_rc_fpath_darwin new file mode 100644 index 0000000..53249e8 --- /dev/null +++ b/zsh/func/init_rc_fpath_darwin @@ -0,0 +1,17 @@ +# Eryn Wells + +autoload -Uz binary_exists + +function init_rc_fpath_darwin +{ + if binary_exists brew; then + local brew_fpath="$(brew --prefix)/share/zsh/site-functions" + if [[ -d "$brew_fpath" ]]; then + fpath+=($brew_fpath) + fi + + export FPATH + fi +} + +init_rc_fpath_darwin "$@" diff --git a/zshrc b/zshrc index a37a4e2..ae5e58d 100644 --- a/zshrc +++ b/zshrc @@ -1,6 +1,7 @@ # Eryn Wells zsh_init_rc_functions=( \ + init_rc_fpath_darwin \ init_rc_aliases \ init_configure_ls \ init_rc_tilde_paths \