Skip to content

Commit

Permalink
fix: initializing homebrew
Browse files Browse the repository at this point in the history
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
  • Loading branch information
vladdoster committed Mar 30, 2023
1 parent a7e525e commit e0ceff0
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions zsh/.config/zsh/rc.d/01-env.zsh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env zsh

# emulate -L zsh -o EXTENDED_GLOB
emulate zsh
setopt EXTENDED_GLOB

#
# Environment variables
Expand All @@ -25,14 +26,25 @@ export \
# Modifying one will also modify the other.
# Note that each value in an array is expanded separately. Thus, we can use ~
# for $HOME in each $path entry.
_comp_dumpfile="$ZDOTDIR/zcompdump"
typeset -gU FPATH PATH fpath path
path=( /{opt,usr/local}/homebrew/bin(N) /home/linuxbrew/.linuxbrew/bin(N) $path )
# path=( /{opt,usr/local}/Homebrew/bin(N) /home/linuxbrew/.linuxbrew/bin(N) $path )
fpath=( ~/.config/zsh/(func|comple)tions(N) $fpath )
autoload -Uz ~/.config/zsh/functions/**/*

if (( $+commands[brew] )); then
eval "$(brew shellenv)"
if (( ! $+commands[brew] )); then
if [[ -x /opt/homebrew/bin/brew ]]; then
BREW_LOCATION="/opt/homebrew/bin/brew"
elif [[ -x /usr/local/bin/brew ]]; then
BREW_LOCATION="/usr/local/bin/brew"
elif [[ -x /home/linuxbrew/.linuxbrew/bin/brew ]]; then
BREW_LOCATION="/home/linuxbrew/.linuxbrew/bin/brew"
elif [[ -x "$HOME/.linuxbrew/bin/brew" ]]; then
BREW_LOCATION="$HOME/.linuxbrew/bin/brew"
else
return
fi
eval "$("$BREW_LOCATION" shellenv)"
unset BREW_LOCATION
path+=( ${HOMEBREW_PREFIX}/(s|)bin $path )
fpath+=( $HOMEBREW_PREFIX/share/zsh/site-functions(/N) $fpath )
fi
Expand Down

0 comments on commit e0ceff0

Please sign in to comment.