diff --git a/lib/directories.zsh b/lib/directories.zsh index 1896945f4..b3a478d47 100644 --- a/lib/directories.zsh +++ b/lib/directories.zsh @@ -30,9 +30,6 @@ cd () { cd ../../../.. elif [[ "x$*" == "x......" ]]; then cd ../../../../.. - elif [ -d ~/.autoenv ]; then - source ~/.autoenv/activate.sh - autoenv_cd "$@" else builtin cd "$@" fi diff --git a/plugins/autoenv/autoenv.plugin.zsh b/plugins/autoenv/autoenv.plugin.zsh index ca5666979..960ff667c 100644 --- a/plugins/autoenv/autoenv.plugin.zsh +++ b/plugins/autoenv/autoenv.plugin.zsh @@ -1,3 +1,11 @@ +# Add the functions from autoenv if it's installed. +if [ -r ~/.autoenv/activate.sh ]; then + source ~/.autoenv/activate.sh + # Use a zsh hook instead of overriding the builtin cd. + unset -f cd + add-zsh-hook chpwd autoenv_init +fi + # The use_env call below is a reusable command to activate/create a new Python # virtualenv, requiring only a single declarative line of code in your .env files. # It only performs an action if the requested virtualenv is not the current one.