Is there a way to source a particular file to set up the environment when entering a particular directory? Sort of like what rvm does, but more general.
IMHO you should not use an alias for this but add a hook to any directory change:
autoload -U add-zsh-hook
load-local-conf() {
# check file exists, is regular file and is readable:
if [[ -f .source_me && -r .source_me ]]; then
source .source_me
fi
}
add-zsh-hook chpwd load-local-conf
This hook function will run on any directory change.
FWIW, should you wish to change dirs without trigering the hooks, use cd -q dirname
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With