summaryrefslogtreecommitdiff
path: root/themes
diff options
context:
space:
mode:
authorMarc Cornellà <marc.cornella@live.com>2020-05-21 20:48:23 +0200
committerMarc Cornellà <marc.cornella@live.com>2020-05-21 20:48:46 +0200
commitb721053c87b4662c65452117a8db35af0154a29d (patch)
tree7d2096cbca00d9d8db62fb0f7e04593dd4bf3ed7 /themes
parent25d0b2dfbd4f4c915a9c04e29a97b82ebd4e612c (diff)
downloadzsh-b721053c87b4662c65452117a8db35af0154a29d.tar.gz
zsh-b721053c87b4662c65452117a8db35af0154a29d.tar.bz2
zsh-b721053c87b4662c65452117a8db35af0154a29d.zip
af-magic: account for active conda envs in dash line
See https://github.com/ohmyzsh/ohmyzsh/issues/8081#issuecomment-632182715
Diffstat (limited to 'themes')
-rw-r--r--themes/af-magic.zsh-theme11
1 files changed, 8 insertions, 3 deletions
diff --git a/themes/af-magic.zsh-theme b/themes/af-magic.zsh-theme
index 148991fec..1d2af3458 100644
--- a/themes/af-magic.zsh-theme
+++ b/themes/af-magic.zsh-theme
@@ -10,9 +10,14 @@ typeset +H my_orange="$FG[214]"
# separator dashes size
function afmagic_dashes {
- [[ -n "${VIRTUAL_ENV-}" && -z "${VIRTUAL_ENV_DISABLE_PROMPT-}" && "$PS1" = \(* ]] \
- && echo $(( COLUMNS - ${#VIRTUAL_ENV} - 3 )) \
- || echo $COLUMNS
+ local PYTHON_ENV="$VIRTUAL_ENV"
+ [[ -z "$PYTHON_ENV" ]] && PYTHON_ENV="$CONDA_DEFAULT_ENV"
+
+ if [[ -n "$PYTHON_ENV" && "$PS1" = \(* ]]; then
+ echo $(( COLUMNS - ${#PYTHON_ENV} - 3 ))
+ else
+ echo $COLUMNS
+ fi
}
# primary prompt