Browse code

merge steeef.zsh-theme from master

steeef authored on 01/10/2010 at 21:11:53
Showing 1 changed files
... ...
@@ -3,6 +3,9 @@
3 3
 #
4 4
 # vcs_info modifications from Bart Trojanowski's zsh prompt:
5 5
 # http://www.jukie.net/bart/blog/pimping-out-zsh-prompt
6
+#
7
+# git untracked files modification from Brian Carper:
8
+# http://briancarper.net/blog/570/git-info-in-your-zsh-prompt
6 9
 
7 10
 function virtualenv_info {
8 11
     [ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') '
... ...
@@ -17,6 +20,9 @@ autoload -U add-zsh-hook
17 17
 autoload -Uz vcs_info
18 18
 
19 19
 
20
+# enable VCS systems you use
21
+zstyle ':vcs_info:*' enable git svn
22
+
20 23
 # check-for-changes can be really slow.
21 24
 # you should disable it, if you work with large repositories
22 25
 zstyle ':vcs_info:*:prompt:*' check-for-changes true
... ...
@@ -31,8 +37,8 @@ zstyle ':vcs_info:*:prompt:*' check-for-changes true
31 31
 PR_RST="%{${reset_color}%}"
32 32
 FMT_BRANCH="(%{$fg[magenta]%}%b%u%c${PR_RST})"
33 33
 FMT_ACTION="(%{$fg[green]%}%a${PR_RST})"
34
-FMT_UNSTAGED="%{$fg[yellow]%}!"
35
-FMT_STAGED="%{$fg[yellow]%}?"
34
+FMT_UNSTAGED="%{$fg[yellow]%}●"
35
+FMT_STAGED="%{$fg[green]%}●"
36 36
 
37 37
 zstyle ':vcs_info:*:prompt:*' unstagedstr   "${FMT_UNSTAGED}"
38 38
 zstyle ':vcs_info:*:prompt:*' stagedstr     "${FMT_STAGED}"
... ...
@@ -46,6 +52,9 @@ function steeef_preexec {
46 46
         *git*)
47 47
             PR_GIT_UPDATE=1
48 48
             ;;
49
+        *svn*)
50
+            PR_GIT_UPDATE=1
51
+            ;;
49 52
     esac
50 53
 }
51 54
 add-zsh-hook preexec steeef_preexec
... ...
@@ -56,6 +65,15 @@ function steeef_chpwd {
56 56
 add-zsh-hook chpwd steeef_chpwd
57 57
 
58 58
 function steeef_precmd {
59
+    # check for untracked files or updated submodules, since vcs_info doesn't
60
+    if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) || -n $(git ls-files -m --exclude-standard 2> /dev/null) ]]; then
61
+        PR_GIT_UPDATE=1
62
+        FMT_BRANCH="(%{$fg[magenta]%}%b%u%c%{$fg[red]%}●${PR_RST})"
63
+    else
64
+        FMT_BRANCH="(%{$fg[magenta]%}%b%u%c${PR_RST})"
65
+    fi
66
+    zstyle ':vcs_info:*:prompt:*' formats       "${FMT_BRANCH}"
67
+
59 68
     if [[ -n "$PR_GIT_UPDATE" ]] ; then
60 69
         vcs_info 'prompt'
61 70
         PR_GIT_UPDATE=