From 1552aafd8e81f36b4852cdb6702437c143b07e7e Mon Sep 17 00:00:00 2001 From: Gustavo Braganca Date: Fri, 16 May 2014 20:44:46 +0200 Subject: [PATCH] Adds support to show Conda environment on prompt When one uses a Virtualenv environment, its name is shown in the prompt. The same did not happen with a Conda environment. This fix it. --- gitprompt.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gitprompt.sh b/gitprompt.sh index 33d4c16..49213d9 100755 --- a/gitprompt.sh +++ b/gitprompt.sh @@ -134,6 +134,8 @@ function git_prompt_config() else if [[ -n "${VIRTUAL_ENV}" ]]; then EMPTY_PROMPT="(${Blue}$(basename "${VIRTUAL_ENV}")${ResetColor}) ${PROMPT_START}$($prompt_callback)${PROMPT_END}" + elif [[ -n "${CONDA_DEFAULT_ENV}" ]]; then + EMPTY_PROMPT="(${Blue}$(basename "${CONDA_DEFAULT_ENV}")${ResetColor}) ${PROMPT_START}$($prompt_callback)${PROMPT_END}" else EMPTY_PROMPT="${PROMPT_START}$($prompt_callback)${PROMPT_END}" fi @@ -268,6 +270,10 @@ function updatePrompt() { PS1="(${Blue}$(basename ${VIRTUAL_ENV})${ResetColor}) ${PS1}" fi + if [[ -n "${CONDA_DEFAULT_ENV}" ]]; then + PS1="(${Blue}$(basename ${CONDA_DEFAULT_ENV})${ResetColor}) ${PS1}" + fi + else PS1="${EMPTY_PROMPT}" fi @@ -310,4 +316,4 @@ function run { source "$__GIT_PROMPT_DIR/git-prompt-help.sh" } -run \ No newline at end of file +run