14f0f2971f42952e2eb78fdc2535538e98323b2b

Author
Oleg Voronkovich <oleg-voronkovich@yandex.ru>
Committer
GitHub <noreply@github.com>
Date

Message

feat(brew): autoconfigure completions (#11152)

Diff

 1diff --git a/plugins/brew/README.md b/plugins/brew/README.md
 2index 412daae6353f4de7951a466188d3f6d8ef5e42a0..4730194bc681fcf7c501b5312cc2eec15f4718d1 100644
 3--- a/plugins/brew/README.md
 4+++ b/plugins/brew/README.md
 5@@ -33,6 +33,8 @@ defined for convenience.
 6 
 7 ## Completion
 8 
 9+This plugin configures paths with Homebrew's completion functions automatically, so you don't need to do it manually. See: https://docs.brew.sh/Shell-Completion#configuring-completions-in-zsh.
10+
11 With the release of Homebrew 1.0, they decided to bundle the zsh completion as part of the
12 brew installation, so we no longer ship it with the brew plugin; now it only has brew
13 aliases. If you find that brew completion no longer works, make sure you have your Homebrew
14diff --git a/plugins/brew/brew.plugin.zsh b/plugins/brew/brew.plugin.zsh
15index f6abe08751ac24a3305d8f0871e2d5fb7499c3de..b52664a3900cad17024adb4f818daad267872872 100644
16--- a/plugins/brew/brew.plugin.zsh
17+++ b/plugins/brew/brew.plugin.zsh
18@@ -25,6 +25,10 @@ if [[ -z "$HOMEBREW_PREFIX" ]]; then
19   export HOMEBREW_PREFIX="$(brew --prefix)"
20 fi
21 
22+if [[ -d "$HOMEBREW_PREFIX/share/zsh/site-functions" ]]; then
23+  fpath+=("$HOMEBREW_PREFIX/share/zsh/site-functions")
24+fi
25+
26 alias bcubc='brew upgrade --cask && brew cleanup'
27 alias bcubo='brew update && brew outdated --cask'
28 alias bcubc='brew upgrade --cask && brew cleanup'