894e1caa0a7fb2e02aa139d23d0b05d62c6d8932

Author
Andrew Grangaard <Andrew.Grangaard@demandmedia.com>
Committer
Andrew Grangaard <Andrew.Grangaard@demandmedia.com>
Date

Message

virtualenv cleanup: replaces subshell with prompt expansion.

* :t parameter expansion returns the last portion of the path,
  equivalent to basename. I <3 zsh.
* adds comments for the VIRTUAL_ENV_DISABLE_PROMPT,
  used by virtual_env activate

See also:
  http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion

Diff

 1diff --git a/plugins/virtualenv/virtualenv.plugin.zsh b/plugins/virtualenv/virtualenv.plugin.zsh
 2index e8458389f610d72750bb58940f52a7ca01ca44d5..8e06450b1ef028aa189b7449624361fd73d6f20e 100644
 3--- a/plugins/virtualenv/virtualenv.plugin.zsh
 4+++ b/plugins/virtualenv/virtualenv.plugin.zsh
 5@@ -1,9 +1,8 @@
 6 function virtualenv_prompt_info(){
 7-  local virtualenv_path="$VIRTUAL_ENV"
 8-  if [[ -n $virtualenv_path ]]; then
 9-    local virtualenv_name=`basename $virtualenv_path`
10-    printf "%s[%s] " "%{${fg[yellow]}%}" $virtualenv_name
11+  if [[ -n $VIRTUAL_ENV ]]; then
12+    printf "%s[%s] " "%{${fg[yellow]}%}" ${${VIRTUAL_ENV}:t}
13   fi
14 }
15 
16+# disables prompt mangling in virtual_env/bin/activate
17 export VIRTUAL_ENV_DISABLE_PROMPT=1