Fix z sourcing
This commit is contained in:
parent
f48a60f40e
commit
4270c8bf72
|
@ -5,13 +5,23 @@
|
||||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||||
#
|
#
|
||||||
|
|
||||||
if [[ -f /etc/profile.d/z.zsh ]]; then
|
_z_prefixes=(
|
||||||
source /etc/profile.d/z.zsh
|
''
|
||||||
elif [[ -f /opt/local/etc/profile.d/z.zsh ]]; then
|
'/usr/local'
|
||||||
source /opt/local/etc/profile.d/z.zsh
|
'/opt/local'
|
||||||
elif [[ -f "$(brew --prefix 2> /dev/null)/etc/profile.d/z.sh" ]]; then
|
"$(brew --prefix 2> /dev/null)"
|
||||||
source "$(brew --prefix 2> /dev/null)/etc/profile.d/z.sh"
|
)
|
||||||
fi
|
|
||||||
|
for _z_prefix in "$_z_prefixes[@]"; do
|
||||||
|
_z_sh="${_z_prefix}/etc/profile.d/z.sh"
|
||||||
|
|
||||||
|
if [[ -f "$_z_sh" ]]; then
|
||||||
|
source "$_z_sh"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
unset _z_prefix{es,} _z_sh
|
||||||
|
|
||||||
if (( $+functions[_z] )); then
|
if (( $+functions[_z] )); then
|
||||||
alias z='nocorrect _z 2>&1'
|
alias z='nocorrect _z 2>&1'
|
||||||
|
|
Loading…
Reference in a new issue