diff options
| author | Carlo Sala <carlosalag@protonmail.com> | 2024-08-01 20:07:55 +0200 |
|---|---|---|
| committer | Carlo Sala <carlosalag@protonmail.com> | 2024-08-01 20:12:16 +0200 |
| commit | 5c532a85cf7c4f1d5bf6b9fd35e964b4545c8de3 (patch) | |
| tree | 5c73303a6390cbbe499e9fec0ef54410818d2a2f /plugins/pyenv | |
| parent | 2527959e79432bb28269840e5b8b81ef3acf187a (diff) | |
| download | zsh-5c532a85cf7c4f1d5bf6b9fd35e964b4545c8de3.tar.gz zsh-5c532a85cf7c4f1d5bf6b9fd35e964b4545c8de3.tar.bz2 zsh-5c532a85cf7c4f1d5bf6b9fd35e964b4545c8de3.zip | |
fix(pyenv)!: do not load if a virtualenv is present
BREAKING CHANGE: `pyenv` will not be loaded at startup anymore if a
virtual env if found to avoid overwriting the expected python version.
Closes #12589
Diffstat (limited to 'plugins/pyenv')
| -rw-r--r-- | plugins/pyenv/README.md | 2 | ||||
| -rw-r--r-- | plugins/pyenv/pyenv.plugin.zsh | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/plugins/pyenv/README.md b/plugins/pyenv/README.md index f18fc8cfb..95d79cb52 100644 --- a/plugins/pyenv/README.md +++ b/plugins/pyenv/README.md @@ -2,7 +2,7 @@ This plugin looks for [pyenv](https://github.com/pyenv/pyenv), a Simple Python version management system, and loads it if it's found. It also loads pyenv-virtualenv, a pyenv -plugin to manage virtualenv, if it's found. +plugin to manage virtualenv, if it's found. If a venv is found pyenv won't load. To use it, add `pyenv` to the plugins array in your zshrc file: diff --git a/plugins/pyenv/pyenv.plugin.zsh b/plugins/pyenv/pyenv.plugin.zsh index 48c8ffaf5..b5c9a7bd3 100644 --- a/plugins/pyenv/pyenv.plugin.zsh +++ b/plugins/pyenv/pyenv.plugin.zsh @@ -1,3 +1,7 @@ +# if there is a virtualenv already loaded pyenv should not be loaded +# see https://github.com/ohmyzsh/ohmyzsh/issues/12589 +[[ -n ${VIRTUAL_ENV:-} ]] && return + pyenv_config_warning() { [[ "$ZSH_PYENV_QUIET" != true ]] || return 0 |
