ebfc9042ed2121c1d330a6767736fbf7bff2e369

Author
Gong Hao <gonghao@ghsky.com>
Committer
Gong Hao <gonghao@ghsky.com>
Date

Message

add virtualenv prompt support for agnoster theme

Diff

 1diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme
 2index e652938588ab95ab9b790e37cd3047f7998e4070..c7a59ad0d67951960f1a9edb4544bd1da6aa849e 100644
 3--- a/themes/agnoster.zsh-theme
 4+++ b/themes/agnoster.zsh-theme
 5@@ -134,6 +134,14 @@ prompt_dir() {
 6   prompt_segment blue black '%~'
 7 }
 8 
 9+# Virtualenv: current working virtualenv
10+prompt_virtualenv() {
11+  local virtualenv_path="$VIRTUAL_ENV"
12+  if [[ -n $virtualenv_path ]]; then
13+    prompt_segment blue black "(`basename $virtualenv_path`)"
14+  fi
15+}
16+
17 # Status:
18 # - was there an error
19 # - am I root
20@@ -152,6 +160,7 @@ prompt_status() {
21 build_prompt() {
22   RETVAL=$?
23   prompt_status
24+  prompt_virtualenv
25   prompt_context
26   prompt_dir
27   prompt_git