b721053c87b4662c65452117a8db35af0154a29d

Author
Marc Cornellà <marc.cornella@live.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

af-magic: account for active conda envs in dash line

See https://github.com/ohmyzsh/ohmyzsh/issues/8081#issuecomment-632182715

Diff

 1diff --git a/themes/af-magic.zsh-theme b/themes/af-magic.zsh-theme
 2index 148991fecd48f1f59cff1309b5747e720c7b850d..1d2af34584c688abc449374ea16b9ee4518003e6 100644
 3--- a/themes/af-magic.zsh-theme
 4+++ b/themes/af-magic.zsh-theme
 5@@ -10,9 +10,14 @@ typeset +H my_orange="$FG[214]"
 6 
 7 # separator dashes size
 8 function afmagic_dashes {
 9-	[[ -n "${VIRTUAL_ENV-}" && -z "${VIRTUAL_ENV_DISABLE_PROMPT-}" && "$PS1" = \(* ]] \
10-		&& echo $(( COLUMNS - ${#VIRTUAL_ENV} - 3 )) \
11-		|| echo $COLUMNS
12+	local PYTHON_ENV="$VIRTUAL_ENV"
13+	[[ -z "$PYTHON_ENV" ]] && PYTHON_ENV="$CONDA_DEFAULT_ENV"
14+
15+	if [[ -n "$PYTHON_ENV" && "$PS1" = \(* ]]; then
16+		echo $(( COLUMNS - ${#PYTHON_ENV} - 3 ))
17+	else
18+		echo $COLUMNS
19+	fi
20 }
21 
22 # primary prompt