From ecc34e00511eee18501b39afd2998c416219849c Mon Sep 17 00:00:00 2001 From: Matthew Crenshaw Date: Wed, 21 Jun 2017 15:30:57 -0400 Subject: [PATCH] Move virtualenv auto-switch cwd hook optional loader out from inside unrelated if statement (#1338) --- modules/python/init.zsh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/modules/python/init.zsh b/modules/python/init.zsh index 47f7b5a..859569d 100644 --- a/modules/python/init.zsh +++ b/modules/python/init.zsh @@ -76,6 +76,12 @@ function _python-workon-cwd { fi } +# Load auto workon cwd hook +if zstyle -t ':prezto:module:python:virtualenv' auto-switch 'yes'; then + # Auto workon when changing directory + add-zsh-hook chpwd _python-workon-cwd +fi + # Load virtualenvwrapper into the shell session, unless requested not to if zstyle -T ':prezto:module:python' skip-virtualenvwrapper-init; then # Set the directory where virtual environments are stored. @@ -105,14 +111,7 @@ if (( $+commands[pip] )); then fi source "$cache_file" - unset cache_file - - # Load auto workon cwd hook - if zstyle -t ':prezto:module:python:virtualenv' auto-switch 'yes'; then - # Auto workon when changing directory - add-zsh-hook chpwd _python-workon-cwd - fi fi #