When using direnv in a shell, it automatically unloads the environment upon leaving the directory. However, this plugin does not register when a directory containing a .envrc is exited, so the environment never gets unloaded. If the new directory does contain a .envrc, the new environment is loaded and the old one unloaded at the same time.
Steps to reproduce
Create 3 directories, 2 with a .envrc and 1 without
.envrc 1:
.envrc 2:
When in directory 1, running :Direnv allow and :echo $FOO gives foo.
After running :cd to directory 2 and :Direnv allow, :echo $FOO is empty and :echo $BAR gives bar.
After running :cd to directory 3, :Direnv allow warns that there is no .envrc in the current directory. :Direnv reload does nothing, and :echo $BAR still gives bar, despite having exited the directory where it was declared.
When using direnv in a shell, it automatically unloads the environment upon leaving the directory. However, this plugin does not register when a directory containing a .envrc is exited, so the environment never gets unloaded. If the new directory does contain a .envrc, the new environment is loaded and the old one unloaded at the same time.
Steps to reproduce
Create 3 directories, 2 with a .envrc and 1 without
.envrc1:.envrc2:When in directory 1, running
:Direnv allowand:echo $FOOgives foo.After running
:cdto directory 2 and:Direnv allow,:echo $FOOis empty and:echo $BARgives bar.After running
:cdto directory 3,:Direnv allowwarns that there is no.envrcin the current directory.:Direnv reloaddoes nothing, and:echo $BARstill gives bar, despite having exited the directory where it was declared.