Browse Source

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

Closes #9443

Co-authored-by: Pandu POLUAN <pepoluan@gmail.com>
Marc Cornellà 3 years ago
parent
commit
1b03896a0e
2 changed files with 4 additions and 1 deletions
  1. 3 0
      plugins/pyenv/README.md
  2. 1 1
      plugins/pyenv/pyenv.plugin.zsh

+ 3 - 0
plugins/pyenv/README.md

@@ -15,6 +15,9 @@ plugins=(... pyenv)
 - `ZSH_PYENV_QUIET`: if set to `true`, the plugin will not print any messages if it
   finds that `pyenv` is not properly configured.
 
+- `ZSH_PYENV_VIRTUALENV`: if set to `false`, the plugin will not load pyenv-virtualenv
+  when it finds it.
+
 ## Functions
 
 - `pyenv_prompt_info`: displays the Python version in use by pyenv; or the global Python

+ 1 - 1
plugins/pyenv/pyenv.plugin.zsh

@@ -78,7 +78,7 @@ if [[ $FOUND_PYENV -eq 1 ]]; then
   eval "$(pyenv init - --no-rehash zsh)"
 
   # If pyenv-virtualenv exists, load it
-  if [[ -d "$PYENV_ROOT/plugins/pyenv-virtualenv" ]]; then
+  if [[ -d "$PYENV_ROOT/plugins/pyenv-virtualenv" && "$ZSH_PYENV_VIRTUALENV" != false ]]; then
     eval "$(pyenv virtualenv-init - zsh)"
   fi