From 6e57082acafc224962560c2de7b3fb696967f82d Mon Sep 17 00:00:00 2001 From: crater2150 <crater@qwertyuiop.de> Date: Fri, 26 Feb 2021 17:25:55 +0100 Subject: [PATCH] Add missing pyenv plugin --- plugins/pyenv/pyenv.plugin.zsh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 plugins/pyenv/pyenv.plugin.zsh diff --git a/plugins/pyenv/pyenv.plugin.zsh b/plugins/pyenv/pyenv.plugin.zsh new file mode 100644 index 0000000..1c7dbcc --- /dev/null +++ b/plugins/pyenv/pyenv.plugin.zsh @@ -0,0 +1,17 @@ +export PYENV_ROOT=${XDG_DATA_HOME:-$HOME/.local/share}/pyenv +_init_pyenv() { + export PATH="$PATH:$PYENV_ROOT/bin" + eval "$(pyenv init -)" + if pyenv commands | grep -q 'virtualenv'; then + eval "$(pyenv virtualenv-init -)" + fi +} +if [[ -d $PYENV_ROOT ]]; then + _init_pyenv +else + pyenv() { + echo -n "pyenv is not installed. Install now? [yn] "; read -q || return + git clone https://github.com/pyenv/pyenv.git $PYENV_ROOT + _init_pyenv + } +fi