From e6561f578ff5e8c9f38da24dd5b1af2e5c7bc5d2 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Thu, 10 Sep 2026 04:49:39 -0700 Subject: [PATCH] fix(agnoster): respect conda changeps1 and escape env name (#14042) Co-authored-by: John Pocock --- themes/agnoster.zsh-theme | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme index 63452378d..6b6c202a9 100644 --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -314,8 +314,11 @@ prompt_dir() { # Virtualenv: current working virtualenv prompt_virtualenv() { - if [ -n "$CONDA_DEFAULT_ENV" ]; then - prompt_segment magenta $CURRENT_FG "🐍 $CONDA_DEFAULT_ENV" + # Skip the conda segment when conda is already showing the environment itself, + # i.e. when changeps1 is left on. This mirrors how VIRTUAL_ENV_DISABLE_PROMPT + # is handled below, and stops the name appearing twice in the prompt. + if [[ -n "$CONDA_DEFAULT_ENV" && -z "$CONDA_PROMPT_MODIFIER" ]]; then + prompt_segment magenta $CURRENT_FG "🐍 ${CONDA_DEFAULT_ENV:t:gs/%/%%}" fi if [[ -n "$VIRTUAL_ENV" && -n "$VIRTUAL_ENV_DISABLE_PROMPT" ]]; then prompt_segment "$AGNOSTER_VENV_BG" "$AGNOSTER_VENV_FG" "(${VIRTUAL_ENV:t:gs/%/%%})"