From 219f5a05231c7d53f1061a56103a57e57bdfc062 Mon Sep 17 00:00:00 2001 From: crater2150 Date: Fri, 18 Jun 2021 12:10:01 +0200 Subject: [PATCH] pyenv: initialize only on demand --- plugins/pyenv/pyenv.plugin.zsh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/pyenv/pyenv.plugin.zsh b/plugins/pyenv/pyenv.plugin.zsh index 1c7dbcc..b09b2dd 100644 --- a/plugins/pyenv/pyenv.plugin.zsh +++ b/plugins/pyenv/pyenv.plugin.zsh @@ -1,5 +1,6 @@ export PYENV_ROOT=${XDG_DATA_HOME:-$HOME/.local/share}/pyenv _init_pyenv() { + unfunction _pyenv export PATH="$PATH:$PYENV_ROOT/bin" eval "$(pyenv init -)" if pyenv commands | grep -q 'virtualenv'; then @@ -7,7 +8,10 @@ _init_pyenv() { fi } if [[ -d $PYENV_ROOT ]]; then - _init_pyenv + pyenv() { + _init_pyenv + pyenv $@ + } else pyenv() { echo -n "pyenv is not installed. Install now? [yn] "; read -q || return