From 0e5fed193edf0073fab5adaac61f7b912ea86060 Mon Sep 17 00:00:00 2001
From: MrAureliusR <41264289+MrAureliusR@users.noreply.github.com>
Date: Fri, 23 Apr 2021 09:51:31 -0400
Subject: [PATCH] feat(ys): add virtualenv prompt info (#8453)

---
 themes/ys.zsh-theme | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/themes/ys.zsh-theme b/themes/ys.zsh-theme
index 95067060b..303c898b4 100644
--- a/themes/ys.zsh-theme
+++ b/themes/ys.zsh-theme
@@ -37,6 +37,15 @@ ys_hg_prompt_info() {
 	fi
 }
 
+# Virtualenv
+local venv_info='$(virtenv_prompt)'
+YS_THEME_VIRTUALENV_PROMPT_PREFIX=" %{$fg[green]%}"
+YS_THEME_VIRTUALENV_PROMPT_SUFFIX=" %{$reset_color%}%"
+virtenv_prompt() {
+	[[ -n ${VIRTUAL_ENV} ]] || return
+	echo "${YS_THEME_VIRTUALENV_PROMPT_PREFIX}${VIRTUAL_ENV:t}${YS_THEME_VIRTUALENV_PROMPT_SUFFIX}"
+}
+
 local exit_code="%(?,,C:%{$fg[red]%}%?%{$reset_color%})"
 
 # Prompt format:
@@ -57,6 +66,7 @@ PROMPT="
 %{$terminfo[bold]$fg[yellow]%}%~%{$reset_color%}\
 ${hg_info}\
 ${git_info}\
+${venv_info}\
  \
 %{$fg[white]%}[%*] $exit_code
 %{$terminfo[bold]$fg[red]%}$ %{$reset_color%}"