From e501f8aace3a7511ce37fee167b88aa04deda6f2 Mon Sep 17 00:00:00 2001 From: John Pocock Date: Fri, 17 Aug 2018 00:54:59 +0100 Subject: [PATCH 1/4] Added current working anaconda env to agnoster prompt --- themes/agnoster.zsh-theme | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme index d91f98735..9f222ee11 100644 --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -198,6 +198,19 @@ prompt_virtualenv() { fi } +# Anaconda: current working conda env +# To replace the conda modification of PS1 do `conda config --set changeps1 False` +# or add 'changeps1: False' to your .condarc file. +prompt_conda() { + local conda_env="$CONDA_DEFAULT_ENV" + if [[ -n $conda_env ]]; then + local conda_changeps1="`conda config --show changeps1`" + if [[ $conda_changeps1 == "changeps1: False" && $conda_env != "base" ]]; then + prompt_segment blue black "($CONDA_DEFAULT_ENV)" + fi + fi +} + # Status: # - was there an error # - am I root @@ -216,6 +229,7 @@ prompt_status() { build_prompt() { RETVAL=$? prompt_status + prompt_conda prompt_virtualenv prompt_context prompt_dir From 2422635513896685b6439d09a730d4c80c2fbd9e Mon Sep 17 00:00:00 2001 From: John Pocock Date: Thu, 5 Mar 2020 20:39:13 +0000 Subject: [PATCH 2/4] Update themes/agnoster.zsh-theme Change conda execution to env variable to improve performance. Co-Authored-By: Avraham Shukron --- themes/agnoster.zsh-theme | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme index 9f222ee11..6d66f8c4c 100644 --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -204,8 +204,7 @@ prompt_virtualenv() { prompt_conda() { local conda_env="$CONDA_DEFAULT_ENV" if [[ -n $conda_env ]]; then - local conda_changeps1="`conda config --show changeps1`" - if [[ $conda_changeps1 == "changeps1: False" && $conda_env != "base" ]]; then + if [[ -z $CONDA_PROMPT_MODIFIER ]]; then prompt_segment blue black "($CONDA_DEFAULT_ENV)" fi fi From a6465f839f01b59cd4782b32b1921ccb5964eb3c Mon Sep 17 00:00:00 2001 From: John Pocock Date: Thu, 5 Mar 2020 20:41:43 +0000 Subject: [PATCH 3/4] Update themes/agnoster.zsh-theme Change conda prompt format to "conda:$conda_env" Co-Authored-By: Avraham Shukron --- themes/agnoster.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme index 6d66f8c4c..501f19376 100644 --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -205,7 +205,7 @@ prompt_conda() { local conda_env="$CONDA_DEFAULT_ENV" if [[ -n $conda_env ]]; then if [[ -z $CONDA_PROMPT_MODIFIER ]]; then - prompt_segment blue black "($CONDA_DEFAULT_ENV)" + prompt_segment blue black "conda:$conda_env" fi fi } From ba7a5e68e63e454b8dacc41d6f6e9c3c5ddae14b Mon Sep 17 00:00:00 2001 From: John Pocock Date: Sun, 22 Mar 2020 10:47:29 +0000 Subject: [PATCH 4/4] Update themes/agnoster.zsh-theme Use basename when setting prompt segment text for the conda environment to avoid overly long promps when using an environment created outside the default location. Co-Authored-By: Avraham Shukron --- themes/agnoster.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme index 501f19376..26962e4fa 100644 --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -205,7 +205,7 @@ prompt_conda() { local conda_env="$CONDA_DEFAULT_ENV" if [[ -n $conda_env ]]; then if [[ -z $CONDA_PROMPT_MODIFIER ]]; then - prompt_segment blue black "conda:$conda_env" + prompt_segment blue black "conda:$(basename $conda_env)" fi fi }