From ba9b5d22dff5ccd7f9732d959a639c3e77be8762 Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Wed, 2 Mar 2011 23:42:01 -0600 Subject: [PATCH] Add support for showing what virtualenv is currently active This works with virtualenvwrapper to detect when a virtualenv is activated and adds "()" before the path that's being displayed. --- themes/doubletime/doubletime.theme.bash | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/themes/doubletime/doubletime.theme.bash b/themes/doubletime/doubletime.theme.bash index 29dfa00..c5a8a42 100644 --- a/themes/doubletime/doubletime.theme.bash +++ b/themes/doubletime/doubletime.theme.bash @@ -25,13 +25,20 @@ doubletime_scm_prompt() { fi } +virtualenv_prompt() { + if [ ! -z "$VIRTUAL_ENV" ] + then + echo "(`basename $VIRTUAL_ENV`) " + fi +} + prompt_setter() { # Save history history -a history -c history -r PS1=" -\t $(scm_char) [\[$THEME_PROMPT_HOST_COLOR\]\u@${THEME_PROMPT_HOST}\[$reset_color\]] \w +\t $(scm_char) [\[$THEME_PROMPT_HOST_COLOR\]\u@${THEME_PROMPT_HOST}\[$reset_color\]] $(virtualenv_prompt)\w $(doubletime_scm_prompt)\[$reset_color\] $ " PS2='> ' PS4='+ ' -- 2.17.1