0e5fed193edf0073fab5adaac61f7b912ea86060
- Author
- MrAureliusR <41264289+MrAureliusR@users.noreply.github.com>
- Committer
- GitHub <noreply@github.com>
- Date
Message
feat(ys): add virtualenv prompt info (#8453)
Diff
1diff --git a/themes/ys.zsh-theme b/themes/ys.zsh-theme
2index 95067060b480d769f3800fadfc7a8d321de18d5a..303c898b457f4c9ba6237b19a47769f3b100cfb1 100644
3--- a/themes/ys.zsh-theme
4+++ b/themes/ys.zsh-theme
5@@ -37,6 +37,15 @@ ys_hg_prompt_info() {
6 fi
7 }
8
9+# Virtualenv
10+local venv_info='$(virtenv_prompt)'
11+YS_THEME_VIRTUALENV_PROMPT_PREFIX=" %{$fg[green]%}"
12+YS_THEME_VIRTUALENV_PROMPT_SUFFIX=" %{$reset_color%}%"
13+virtenv_prompt() {
14+ [[ -n ${VIRTUAL_ENV} ]] || return
15+ echo "${YS_THEME_VIRTUALENV_PROMPT_PREFIX}${VIRTUAL_ENV:t}${YS_THEME_VIRTUALENV_PROMPT_SUFFIX}"
16+}
17+
18 local exit_code="%(?,,C:%{$fg[red]%}%?%{$reset_color%})"
19
20 # Prompt format:
21@@ -57,6 +66,7 @@ PROMPT="
22 %{$terminfo[bold]$fg[yellow]%}%~%{$reset_color%}\
23 ${hg_info}\
24 ${git_info}\
25+${venv_info}\
26 \
27 %{$fg[white]%}[%*] $exit_code
28 %{$terminfo[bold]$fg[red]%}$ %{$reset_color%}"