未验证 提交 0e5fed19 编写于 作者: M MrAureliusR 提交者: GitHub

feat(ys): add virtualenv prompt info (#8453)

上级 b3d1826a
...@@ -37,6 +37,15 @@ ys_hg_prompt_info() { ...@@ -37,6 +37,15 @@ ys_hg_prompt_info() {
fi 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%})" local exit_code="%(?,,C:%{$fg[red]%}%?%{$reset_color%})"
# Prompt format: # Prompt format:
...@@ -57,6 +66,7 @@ PROMPT=" ...@@ -57,6 +66,7 @@ PROMPT="
%{$terminfo[bold]$fg[yellow]%}%~%{$reset_color%}\ %{$terminfo[bold]$fg[yellow]%}%~%{$reset_color%}\
${hg_info}\ ${hg_info}\
${git_info}\ ${git_info}\
${venv_info}\
\ \
%{$fg[white]%}[%*] $exit_code %{$fg[white]%}[%*] $exit_code
%{$terminfo[bold]$fg[red]%}$ %{$reset_color%}" %{$terminfo[bold]$fg[red]%}$ %{$reset_color%}"
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册