From 9875081ef7478d677fb7d51e8218b407a90dc53c Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Mon, 19 Jan 2015 19:01:20 +0100 Subject: [PATCH] Add support for $AUTOENV_DISABLED, which skips the chpwd hook --- autoenv.zsh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/autoenv.zsh b/autoenv.zsh index 561a336..f8c4054 100644 --- a/autoenv.zsh +++ b/autoenv.zsh @@ -267,10 +267,16 @@ _autoenv_get_file_upwards() { _autoenv_chpwd_prev_dir=$PWD _autoenv_chpwd_handler() { - local env_file="$PWD/$AUTOENV_FILE_ENTER" - _autoenv_debug "Calling chpwd handler: PWD=$PWD" + if (( $AUTOENV_DISABLED )); then + _autoenv_debug "Disabled (AUTOENV_DISABLED)." + return + fi + + local env_file="$PWD/$AUTOENV_FILE_ENTER" + _autoenv_debug "env_file: $env_file" + # Handle leave event for previously sourced env files. if [[ $AUTOENV_HANDLE_LEAVE == 1 ]] && (( $#_autoenv_stack_entered )); then local prev_file prev_dir