From 7dc77af94cabf424b077be76208a20c48d321f14 Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Tue, 28 Jan 2014 00:09:58 +0100 Subject: [PATCH] fix VIRTUAL_ENV prompt outside a git repository --- gitprompt.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gitprompt.sh b/gitprompt.sh index f4ca70e..ead38f4 100755 --- a/gitprompt.sh +++ b/gitprompt.sh @@ -97,7 +97,11 @@ function git_prompt_config() PROMPT_END="${GIT_PROMPT_END}" fi - EMPTY_PROMPT="${PROMPT_START}$($prompt_callback)${PROMPT_END}" + if [[ -n "${VIRTUAL_ENV}" ]]; then + EMPTY_PROMPT="${Blue}($(basename "${VIRTUAL_ENV}"))${ResetColor} ${PROMPT_START}$($prompt_callback)${PROMPT_END}" + else + EMPTY_PROMPT="${PROMPT_START}$($prompt_callback)${PROMPT_END}" + fi # fetch remote revisions every other $GIT_PROMPT_FETCH_TIMEOUT (default 5) minutes GIT_PROMPT_FETCH_TIMEOUT=${1-5}