Browse code

Improving git plugin so it can display much more data.

Irakli Gozalishvili authored on 08/10/2010 at 23:27:40
Showing 1 changed files
... ...
@@ -11,3 +11,31 @@ parse_git_dirty () {
11 11
     echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
12 12
   fi
13 13
 }
14
+
15
+# get the status of the working tree
16
+git_prompt_status() {
17
+  INDEX=$(git status --porcelain 2> /dev/null)
18
+  STATUS=""
19
+  if $(echo "$INDEX" | grep '^?? ' &> /dev/null); then
20
+    STATUS="$ZSH_THEME_GIT_PROMPT_UNTRACKED$STATUS"
21
+  fi
22
+  if $(echo "$INDEX" | grep '^A  ' &> /dev/null); then
23
+    STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS"
24
+  elif $(echo "$INDEX" | grep '^M  ' &> /dev/null); then
25
+    STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS"
26
+  fi
27
+  if $(echo "$INDEX" | grep '^ M ' &> /dev/null); then
28
+    STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
29
+  fi
30
+  if $(echo "$INDEX" | grep '^R  ' &> /dev/null); then
31
+    STATUS="$ZSH_THEME_GIT_PROMPT_RENAMED$STATUS"
32
+  fi
33
+  if $(echo "$INDEX" | grep '^ D ' &> /dev/null); then
34
+    STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
35
+  fi
36
+  if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then
37
+    STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS"
38
+  fi
39
+  echo $STATUS
40
+}
41
+