mirror of
https://github.com/jimeh/dotfiles.git
synced 2026-02-19 13:46:41 +00:00
fix(zsh/completion): ensure brew and brew installed shell completion works
This commit is contained in:
14
zshenv
14
zshenv
@@ -137,19 +137,23 @@ if command-exists brew; then
|
|||||||
|
|
||||||
brew-prefix() {
|
brew-prefix() {
|
||||||
local package="$1"
|
local package="$1"
|
||||||
|
local cachekey
|
||||||
|
|
||||||
|
cachekey="$package"
|
||||||
if [[ -z "$package" ]]; then
|
if [[ -z "$package" ]]; then
|
||||||
package="__none__"
|
cachekey="__none__"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n "${_brew_prefix_cache[$package]}" ]]; then
|
if [[ -n "${_brew_prefix_cache[$cachekey]}" ]]; then
|
||||||
echo "${_brew_prefix_cache[$package]}"
|
echo "${_brew_prefix_cache[$cachekey]}"
|
||||||
else
|
else
|
||||||
local result=$(brew --prefix "$package")
|
local result=$(brew --prefix "$package")
|
||||||
_brew_prefix_cache[$package]=$result
|
_brew_prefix_cache["$cachekey"]="$result"
|
||||||
echo $result
|
echo "$result"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export BREW_SITEFUNS="$(brew-prefix)/share/zsh/site-functions"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Linuxbrew
|
# Linuxbrew
|
||||||
|
|||||||
4
zshrc
4
zshrc
@@ -66,6 +66,10 @@ zstyle ':completion:*:make:*' tag-order targets
|
|||||||
|
|
||||||
if [ -d "$ZSH_COMPLETIONS" ]; then fpath=("$ZSH_COMPLETIONS" $fpath); fi
|
if [ -d "$ZSH_COMPLETIONS" ]; then fpath=("$ZSH_COMPLETIONS" $fpath); fi
|
||||||
if [ -d "$DOTZSH_SITEFUNS" ]; then fpath=("$DOTZSH_SITEFUNS" $fpath); fi
|
if [ -d "$DOTZSH_SITEFUNS" ]; then fpath=("$DOTZSH_SITEFUNS" $fpath); fi
|
||||||
|
if [ -d "$BREW_SITEFUNS" ]; then fpath=("$BREW_SITEFUNS" $fpath); fi
|
||||||
|
|
||||||
|
autoload -Uz compinit
|
||||||
|
compinit
|
||||||
|
|
||||||
# setup-completions is a helper function to setup completions for a given
|
# setup-completions is a helper function to setup completions for a given
|
||||||
# command. It takes the command name, the source of the completion, and the
|
# command. It takes the command name, the source of the completion, and the
|
||||||
|
|||||||
Reference in New Issue
Block a user