https://github.com/Tarrasch/zsh-autoenv
direnv
A slightly less featureful alternative that works on more shells. Notably
lacking alias support so you would need to update the PATH to include
specific scripts which is much more annoying.
install
Like any other zsh plugin, clone it somewhere, typically
.local/share/zsh/plugin/zsh-autoenv and then source it in your .zshrc:
source /home/kota/.local/share/zsh/plugins/zsh-autoenv/autoenv.zsh
use
Simply create .autoenv.zsh files wherever you'd like to use them:
autostash alias m='portainer-build'
autostash alias mf='yarn build:client'
autostash alias rp='portainer-run'
When you enter the directory for the first time you'll be prompted to accept the file. Then it should work properly by adding or removing the aliases as you change directories.