Moving all autoenv logic to the plugin file.

-Some of this was previously located in the directories lib.

-Also unsetting the cd override function created by autoenv and replacing
 it with a zsh hook.
This commit is contained in:
Josh Matthews 2013-05-23 11:51:08 -04:00
commit e34c6f9fe1
2 changed files with 8 additions and 3 deletions

View file

@ -30,9 +30,6 @@ cd () {
cd ../../../.. cd ../../../..
elif [[ "x$*" == "x......" ]]; then elif [[ "x$*" == "x......" ]]; then
cd ../../../../.. cd ../../../../..
elif [ -d ~/.autoenv ]; then
source ~/.autoenv/activate.sh
autoenv_cd "$@"
else else
builtin cd "$@" builtin cd "$@"
fi fi

View file

@ -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 # 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. # 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. # It only performs an action if the requested virtualenv is not the current one.