1b03896a0e01ad263439449a0742d0f3339732e2

Author
Marc Cornellà <hello@mcornella.com>
Committer
Marc Cornellà <hello@mcornella.com>
Date

Message

feat(pyenv): don't load pyenv-virtualenv with `ZSH_PYENV_VIRTUALENV=false`

Closes #9443

Co-authored-by: Pandu POLUAN <pepoluan@gmail.com>

Diff

 1diff --git a/plugins/pyenv/README.md b/plugins/pyenv/README.md
 2index 810c679987cdc9a0f5524f8d6efdf41985740d34..b9ee937b7cc19bd98946fbbc09e0e639a65582dd 100644
 3--- a/plugins/pyenv/README.md
 4+++ b/plugins/pyenv/README.md
 5@@ -15,6 +15,9 @@ plugins=(... pyenv)
 6 - `ZSH_PYENV_QUIET`: if set to `true`, the plugin will not print any messages if it
 7   finds that `pyenv` is not properly configured.
 8 
 9+- `ZSH_PYENV_VIRTUALENV`: if set to `false`, the plugin will not load pyenv-virtualenv
10+  when it finds it.
11+
12 ## Functions
13 
14 - `pyenv_prompt_info`: displays the Python version in use by pyenv; or the global Python
15diff --git a/plugins/pyenv/pyenv.plugin.zsh b/plugins/pyenv/pyenv.plugin.zsh
16index 679fc5e528bd485a7afae469523d605635c30f89..922df8ead8d73ea3c4627afb9a5e1fff406fdb69 100644
17--- a/plugins/pyenv/pyenv.plugin.zsh
18+++ b/plugins/pyenv/pyenv.plugin.zsh
19@@ -78,7 +78,7 @@ if [[ $FOUND_PYENV -eq 1 ]]; then
20   eval "$(pyenv init - --no-rehash zsh)"
21 
22   # If pyenv-virtualenv exists, load it
23-  if [[ -d "$PYENV_ROOT/plugins/pyenv-virtualenv" ]]; then
24+  if [[ -d "$PYENV_ROOT/plugins/pyenv-virtualenv" && "$ZSH_PYENV_VIRTUALENV" != false ]]; then
25     eval "$(pyenv virtualenv-init - zsh)"
26   fi
27