7fb0b210e88bcbdb71d2cb0022c35b2cc3810327

Author
steeef <steeef@gmail.com>
Committer
steeef <steeef@gmail.com>
Date

Message

merge steeef.zsh-theme from master

Diff

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