From ee885d42decf58ba90ddff250bb9c05f66009397 Mon Sep 17 00:00:00 2001 From: Kaleb Elwert Date: Fri, 28 Sep 2018 14:04:20 -0700 Subject: [PATCH 1/3] python: use pure's magic value for VIRTUAL_ENV_DISABLE_PROMPT Fixes #1627 --- modules/python/init.zsh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/python/init.zsh b/modules/python/init.zsh index 28f671e0..f90156fd 100644 --- a/modules/python/init.zsh +++ b/modules/python/init.zsh @@ -93,8 +93,11 @@ if (( $+VIRTUALENVWRAPPER_VIRTUALENV || $+commands[virtualenv] )) && \ # Set the directory where virtual environments are stored. export WORKON_HOME="${WORKON_HOME:-$HOME/.virtualenvs}" - # Disable the virtualenv prompt. - export VIRTUAL_ENV_DISABLE_PROMPT=1 + # Disable the virtualenv prompt. Note that we use the magic value used by the + # pure prompt because there's some additional logic in that prompt which tries + # to figure out if a user set this variable and disable the python portion of + # that prompt based on it which is the exact opposite of what we want to do. + export VIRTUAL_ENV_DISABLE_PROMPT=12 # Create a sorted array of available virtualenv related 'pyenv' commands to # look for plugins of interest. Scanning shell '$path' isn't enough as they From e9387a177e04b05dcf4f82e622615ddd32c558db Mon Sep 17 00:00:00 2001 From: Kaleb Elwert Date: Fri, 28 Sep 2018 14:24:25 -0700 Subject: [PATCH 2/3] python: respect PYENV_ROOT if already set Fixes #1578 --- modules/python/init.zsh | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/modules/python/init.zsh b/modules/python/init.zsh index f90156fd..9796294c 100644 --- a/modules/python/init.zsh +++ b/modules/python/init.zsh @@ -7,15 +7,18 @@ # Patrick Bos # -# Load manually installed pyenv into the shell session. -if [[ -s "$HOME/.pyenv/bin/pyenv" ]]; then +# Load manually installed pyenv into the path +if [[ -n "$PYENV_ROOT" && -s "$PYENV_ROOT/bin/pyenv" ]]; then + path=("$PYENV_ROOT/bin" $path) +elif [[ -s "$HOME/.pyenv/bin/pyenv" ]]; then path=("$HOME/.pyenv/bin" $path) - export PYENV_ROOT=$(pyenv root) - eval "$(pyenv init - --no-rehash zsh)" +fi -# Load package manager installed pyenv into the shell session. -elif (( $+commands[pyenv] )); then - export PYENV_ROOT=$(pyenv root) +# Load pyenv into the current python session +if (( $+commands[pyenv] )); then + if [[ -z "$PYENV_ROOT" ]]; then + export PYENV_ROOT=$(pyenv root) + fi eval "$(pyenv init - --no-rehash zsh)" # Prepend PEP 370 per user site packages directory, which defaults to @@ -57,7 +60,7 @@ function _python-workon-cwd { local ENV_NAME="" if [[ -f "$PROJECT_ROOT/.venv" ]]; then ENV_NAME="$(cat "$PROJECT_ROOT/.venv")" - elif [[ -f "$PROJECT_ROOT/.venv/bin/activate" ]];then + elif [[ -f "$PROJECT_ROOT/.venv/bin/activate" ]]; then ENV_NAME="$PROJECT_ROOT/.venv" elif [[ "$PROJECT_ROOT" != "." ]]; then ENV_NAME="${PROJECT_ROOT:t}" From 6c46804f418effb65442c6d92f63950f831c281e Mon Sep 17 00:00:00 2001 From: Kaleb Elwert Date: Fri, 28 Sep 2018 14:51:59 -0700 Subject: [PATCH 3/3] environment: only enable bracketed paste on non-dumb terminals Fixes #1552 --- modules/environment/init.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/environment/init.zsh b/modules/environment/init.zsh index 4f3bbfe3..7ae8c4f6 100644 --- a/modules/environment/init.zsh +++ b/modules/environment/init.zsh @@ -14,7 +14,7 @@ # paste had a regression. Additionally, 5.2 added bracketed-paste-url-magic # which is generally better than url-quote-magic so we load that when possible. autoload -Uz is-at-least -if [[ ${ZSH_VERSION} != 5.1.1 ]]; then +if [[ ${ZSH_VERSION} != 5.1.1 && ${TERM} != "dumb" ]]; then if is-at-least 5.2; then autoload -Uz bracketed-paste-url-magic zle -N bracketed-paste bracketed-paste-url-magic