-
Notifications
You must be signed in to change notification settings - Fork 14
/
zsh-pyenv.plugin.zsh
32 lines (26 loc) · 1.05 KB
/
zsh-pyenv.plugin.zsh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
GITHUB="https://github.com"
[[ -z "$PYENV_HOME" ]] && export PYENV_HOME="$HOME/.pyenv"
# export PATH
export PATH="$PYENV_HOME/bin:$PATH"
_zsh_pyenv_install() {
echo "Installing pyenv..."
git clone "${GITHUB}/pyenv/pyenv.git" "${PYENV_HOME}"
git clone "${GITHUB}/pyenv/pyenv-doctor.git" "${PYENV_HOME}/plugins/pyenv-doctor"
git clone "${GITHUB}/pyenv/pyenv-installer.git" "${PYENV_HOME}/plugins/pyenv-installer"
git clone "${GITHUB}/pyenv/pyenv-update.git" "${PYENV_HOME}/plugins/pyenv-update"
git clone "${GITHUB}/pyenv/pyenv-virtualenv.git" "${PYENV_HOME}/plugins/pyenv-virtualenv"
git clone "${GITHUB}/pyenv/pyenv-which-ext.git" "${PYENV_HOME}/plugins/pyenv-which-ext"
}
_zsh_pyenv_load() {
eval "$(pyenv init --path)"
eval "$(pyenv init - --no-rehash zsh)"
eval "$(pyenv virtualenv-init - zsh)"
}
# install pyenv if it isnt already installed
if ! command -v pyenv &>/dev/null; then
_zsh_pyenv_install
fi
# load pyenv if it is installed
if command -v pyenv &>/dev/null; then
_zsh_pyenv_load
fi