374b4e02ef80b14c0d70e99f52ee08cce68a1eeb
- Author
- Marc Cornellà <marc.cornella@live.com>
- Committer
- Marc Cornellà <marc.cornella@live.com>
- Date
Message
peepcode: add virtualenv prompt and fix git calls
Diff
1diff --git a/themes/peepcode.zsh-theme b/themes/peepcode.zsh-theme
2index b6dfa6870abc0c2c59b331392e3bdb813b853c7b..044534614f03cd948b31a1ba9deb4b02a606a92f 100644
3--- a/themes/peepcode.zsh-theme
4+++ b/themes/peepcode.zsh-theme
5@@ -4,11 +4,11 @@
6 #
7
8 git_repo_path() {
9- git rev-parse --git-dir 2>/dev/null
10+ command git rev-parse --git-dir 2>/dev/null
11 }
12
13 git_commit_id() {
14- git rev-parse --short HEAD 2>/dev/null
15+ command git rev-parse --short HEAD 2>/dev/null
16 }
17
18 git_mode() {
19@@ -22,23 +22,26 @@ git_mode() {
20 }
21
22 git_dirty() {
23- if [[ "$repo_path" != '.' && `git ls-files -m` != "" ]]; then
24+ if [[ "$repo_path" != '.' && -n "$(command git ls-files -m)" ]]; then
25 echo " %{$fg_bold[grey]%}✗%{$reset_color%}"
26 fi
27 }
28
29 git_prompt() {
30 local cb=$(git_current_branch)
31- if [ -n "$cb" ]; then
32+ if [[ -n "$cb" ]]; then
33 local repo_path=$(git_repo_path)
34 echo " %{$fg_bold[grey]%}$cb %{$fg[white]%}$(git_commit_id)%{$reset_color%}$(git_mode)$(git_dirty)"
35 fi
36 }
37
38-local smiley="%(?,%{$fg[green]%}☺%{$reset_color%},%{$fg[red]%}☹%{$reset_color%})"
39+local smiley='%(?.%F{green}☺%f.%F{red}☹%f)'
40
41 PROMPT='
42-%~
43-${smiley} %{$reset_color%}'
44+${VIRTUAL_ENV:+"($VIRTUAL_ENV) "}%~
45+${smiley} '
46
47-RPROMPT='%{$fg[white]%} $(ruby_prompt_info)$(git_prompt)%{$reset_color%}'
48+RPROMPT='%F{white} $(ruby_prompt_info)$(git_prompt)%{$reset_color%}'
49+
50+# Disable automatic virtualenv prompt change
51+export VIRTUAL_ENV_DISABLE_PROMPT=1