2012-02-01 04:37:51 +00:00
|
|
|
#
|
|
|
|
# Maintains a frequently used directory list for fast directory changes.
|
|
|
|
#
|
|
|
|
# Authors:
|
|
|
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
|
|
|
#
|
2011-08-31 04:02:50 +00:00
|
|
|
|
2012-04-12 00:51:10 +00:00
|
|
|
_z_prefixes=(
|
|
|
|
''
|
|
|
|
'/usr/local'
|
|
|
|
'/opt/local'
|
|
|
|
"$(brew --prefix 2> /dev/null)"
|
|
|
|
)
|
|
|
|
|
|
|
|
for _z_prefix in "$_z_prefixes[@]"; do
|
|
|
|
_z_sh="${_z_prefix}/etc/profile.d/z.sh"
|
|
|
|
|
2012-04-16 18:21:29 +00:00
|
|
|
if [[ -s "$_z_sh" ]]; then
|
2012-04-12 00:51:10 +00:00
|
|
|
source "$_z_sh"
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
unset _z_prefix{es,} _z_sh
|
2011-08-31 04:02:50 +00:00
|
|
|
|
2012-07-23 19:00:44 +00:00
|
|
|
# Return if requirements are not found.
|
|
|
|
if (( ! $+functions[_z] )); then
|
|
|
|
return 1
|
|
|
|
fi
|
2012-04-12 01:00:40 +00:00
|
|
|
|
2012-07-23 19:00:44 +00:00
|
|
|
function _z-precmd {
|
|
|
|
_z --add "${PWD:A}"
|
|
|
|
}
|
2012-04-12 01:00:40 +00:00
|
|
|
|
2012-07-23 19:00:44 +00:00
|
|
|
autoload -Uz add-zsh-hook
|
|
|
|
add-zsh-hook precmd _z-precmd
|
|
|
|
|
|
|
|
alias z='nocorrect _z'
|
|
|
|
alias j='nocorrect _z'
|
2011-08-31 04:02:50 +00:00
|
|
|
|