summaryrefslogtreecommitdiff
path: root/themes/ys.zsh-theme
diff options
context:
space:
mode:
authorMrAureliusR <41264289+MrAureliusR@users.noreply.github.com>2021-04-23 09:51:31 -0400
committerGitHub <noreply@github.com>2021-04-23 15:51:31 +0200
commit0e5fed193edf0073fab5adaac61f7b912ea86060 (patch)
treebd241c78ddd84aba2894c25641e7bbeeb83a3be3 /themes/ys.zsh-theme
parentb3d1826a431028acdbbae1eb5242f5641da17788 (diff)
downloadzsh-0e5fed193edf0073fab5adaac61f7b912ea86060.tar.gz
zsh-0e5fed193edf0073fab5adaac61f7b912ea86060.tar.bz2
zsh-0e5fed193edf0073fab5adaac61f7b912ea86060.zip
feat(ys): add virtualenv prompt info (#8453)
Diffstat (limited to 'themes/ys.zsh-theme')
-rw-r--r--themes/ys.zsh-theme10
1 files changed, 10 insertions, 0 deletions
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%}"