From ed20f715445eafde7dc8eca828927b2bf5b93454 Mon Sep 17 00:00:00 2001 From: Thomas Orozco Date: Sat, 27 Oct 2012 18:51:32 +0200 Subject: [PATCH] Added virtualenv support New Functionnality: + plugins/virtualenv/... plugin: stop virtualenv from prepending '(virtualenv_name)' to the prompt + lib/virtualenv.zsh: provide a virtualenv_prompt_info function that behaves similarly to lib/git.zsh's git_prompt_info Uses: + ZSH_THEME_VIRTUALENV_PROMPT_PREFIX + ZSH_THEME_VIRTUALENV_PROMPT_SUFFIX These variables are added to the output of virtualenv_prompt_info --- lib/virtualenv.zsh | 5 +++++ plugins/virtualenv/virtualenv.plugin.zsh | 3 +++ 2 files changed, 8 insertions(+) create mode 100644 lib/virtualenv.zsh create mode 100644 plugins/virtualenv/virtualenv.plugin.zsh diff --git a/lib/virtualenv.zsh b/lib/virtualenv.zsh new file mode 100644 index 000000000..87049a532 --- /dev/null +++ b/lib/virtualenv.zsh @@ -0,0 +1,5 @@ +# get the name of the virtualenv we are on +function virtualenv_prompt_info() { + active_virtualenv=$(basename $VIRTUAL_ENV 2> /dev/null) || return + [[ -n active_virtualenv ]] && echo "$ZSH_THEME_VIRTUALENV_PROMPT_PREFIX$active_virtualenv$ZSH_THEME_VIRTUALENV_PROMPT_SUFFIX" +} diff --git a/plugins/virtualenv/virtualenv.plugin.zsh b/plugins/virtualenv/virtualenv.plugin.zsh new file mode 100644 index 000000000..5fc197ddc --- /dev/null +++ b/plugins/virtualenv/virtualenv.plugin.zsh @@ -0,0 +1,3 @@ +# Prevent virtualenv from prepending (virtualenv name) to your prompt +# Use virtualenv_prompt_info to add the env to your prompt. +export VIRTUAL_ENV_DISABLE_PROMPT=1