Permalink
Browse files

Display the active virtualenv name in the zsh > prezto > sorin theme …

…prompt
  • Loading branch information...
1 parent 4cfe500 commit 9d83811fc7359141a6da232355ce8f066b8a3e82 @jeffwidman committed Oct 24, 2015
Showing with 9 additions and 1 deletion.
  1. +9 −1 modules/prompt/functions/prompt_sorin_setup
@@ -87,6 +87,11 @@ function prompt_sorin_precmd {
kill -KILL "$_prompt_sorin_precmd_async_pid" &>/dev/null
fi
+ # Check for activated virtualenv
+ if (( $+functions[python-info] )); then
+ python-info
+ fi
+
# Compute slow commands in the background.
trap prompt_sorin_git_info WINCH
prompt_sorin_precmd_async &!
@@ -130,8 +135,11 @@ function prompt_sorin_setup {
zstyle ':prezto:module:git:info:keys' format \
'status' '$(coalesce "%b" "%p" "%c")%s%A%B%S%a%d%m%r%U%u'
+ # %v - virtualenv name.
+ zstyle ':prezto:module:python:info:virtualenv' format '(%v)'
+
# Define prompts.
- PROMPT='${SSH_TTY:+"%F{9}%n%f%F{7}@%f%F{3}%m%f "}%F{4}${_prompt_sorin_pwd}%(!. %B%F{1}#%f%b.)${editor_info[keymap]} '
+ PROMPT='${SSH_TTY:+"%F{9}%n%f%F{7}@%f%F{3}%m%f "}%F{4}$python_info[virtualenv] ${_prompt_sorin_pwd}%(!. %B%F{1}#%f%b.)${editor_info[keymap]} '
RPROMPT=''
SPROMPT='zsh: correct %F{1}%R%f to %F{2}%r%f [nyae]? '
}

0 comments on commit 9d83811

Please sign in to comment.