From cd42812c9bbeff378612482a8f34886d062d0931 Mon Sep 17 00:00:00 2001 From: Richard Maynard Date: Wed, 6 Nov 2013 13:06:22 -0600 Subject: [PATCH] fix virtualenv's with virtualenv plugin / prompt display Virtual Env modifies the prompt in such a way that when used with agnoster the virtualenv will be displayed twice. Using the virtualenv oh-my-zsh plugin disables this behavior (simply because it disables the virtual env prompt mangling) however when using the plugin it would be nice to keep the single prompt display as expected, and still allow for the function to provide prompt info which other themes may use. --- plugins/virtualenv/virtualenv.plugin.zsh | 1 + themes/agnoster.zsh-theme | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/virtualenv/virtualenv.plugin.zsh b/plugins/virtualenv/virtualenv.plugin.zsh index 8e06450b1..774bf88b5 100644 --- a/plugins/virtualenv/virtualenv.plugin.zsh +++ b/plugins/virtualenv/virtualenv.plugin.zsh @@ -6,3 +6,4 @@ function virtualenv_prompt_info(){ # disables prompt mangling in virtual_env/bin/activate export VIRTUAL_ENV_DISABLE_PROMPT=1 +export VIRTUAL_ENV_DISABLE_PROMPT_BY_PLUGIN=1 diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme index 2db565266..3b720feb2 100644 --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -137,7 +137,11 @@ prompt_dir() { # Virtualenv: current working virtualenv prompt_virtualenv() { local virtualenv_path="$VIRTUAL_ENV" - if [[ -n $virtualenv_path && -z $VIRTUAL_ENV_DISABLE_PROMPT ]]; then + if [[ -n $virtualenv_path && + ( -z $VIRTUAL_ENV_DISABLE_PROMPT || + ( -n $VIRTUAL_ENV_DISABLE_PROMPT && + -n $VIRTUAL_ENV_DISABLE_PROMPT_BY_PLUGIN ) + ) ]]; then prompt_segment blue black "(`basename $virtualenv_path`)" fi }