4c807588769a9e9afbaa9b2d2eec7e58652e2212

Author
Michael Aquilina <michaelaquilina@gmail.com>
Committer
Michael Aquilina <michaelaquilina@gmail.com>
Date

Message

Use preexec hook instead of chpwd again

Diff

 1diff --git a/autoswitch_virtualenv.plugin.zsh b/autoswitch_virtualenv.plugin.zsh
 2index eb8028af6c52e5692c20aefe703cd9cce34f16d6..e259f356347ea6fdafb57f8f450b1223a1317a6d 100644
 3--- a/autoswitch_virtualenv.plugin.zsh
 4+++ b/autoswitch_virtualenv.plugin.zsh
 5@@ -130,8 +130,5 @@ function mkvenv()
 6 }
 7 
 8 autoload -Uz add-zsh-hook
 9-add-zsh-hook -D chpwd _check_venv
10-add-zsh-hook chpwd _check_venv
11-
12-# Check if the starting directory contains a .venv
13-_check_venv
14+add-zsh-hook -D preexec _check_venv
15+add-zsh-hook preexec _check_venv
16diff --git a/tests/test_check_venv_path.zunit b/tests/test_check_venv_path.zunit
17index 04a8f56ff67518045a2f333f82753207d8c7de5a..c3098790ffb0f43be60051ed97a7da1818871f2e 100644
18--- a/tests/test_check_venv_path.zunit
19+++ b/tests/test_check_venv_path.zunit
20@@ -12,7 +12,7 @@
21 }
22 
23 @test 'chpwd functions are loaded' {
24-    assert '_check_venv' in $chpwd_functions
25+    assert '_check_venv' in $preexec_functions
26 }
27 
28 @test '_check_venv_path with non-existent path' {