Browse code

Mortal Scumbag Theme

Michael Andersen authored on 29/12/2011 at 00:30:43
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,58 @@
0
+function my_git_prompt() {
1
+  tester=$(git rev-parse --git-dir 2> /dev/null) || return
2
+  
3
+  INDEX=$(git status --porcelain 2> /dev/null)
4
+  STATUS=""
5
+
6
+  # is branch ahead?
7
+  if $(echo "$(git log origin/$(current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
8
+    STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_AHEAD"
9
+  fi
10
+
11
+  # is anything staged?
12
+  if $(echo "$INDEX" | grep -E -e '^(D[ M]|[MARC][ MD]) ' &> /dev/null); then
13
+    STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_STAGED"
14
+  fi
15
+
16
+  # is anything unstaged?
17
+  if $(echo "$INDEX" | grep -E -e '^[ MARC][MD] ' &> /dev/null); then
18
+    STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNSTAGED"
19
+  fi
20
+
21
+  # is anything untracked?
22
+  if $(echo "$INDEX" | grep '^?? ' &> /dev/null); then
23
+    STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED"
24
+  fi
25
+
26
+  # is anything unmerged?
27
+  if $(echo "$INDEX" | grep -E -e '^(A[AU]|D[DU]|U[ADU]) ' &> /dev/null); then
28
+    STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNMERGED"
29
+  fi
30
+
31
+  if [[ -n $STATUS ]]; then
32
+    STATUS=" $STATUS"
33
+  fi
34
+
35
+  echo "$ZSH_THEME_GIT_PROMPT_PREFIX$(my_current_branch)$STATUS$ZSH_THEME_GIT_PROMPT_SUFFIX"
36
+}
37
+
38
+function my_current_branch() {
39
+  echo $(current_branch || echo "(no branch)")
40
+}
41
+
42
+function ssh_connection() {
43
+  if [[ -n $SSH_CONNECTION ]]; then
44
+    echo "%{$fg_bold[red]%}(ssh) "
45
+  fi
46
+}
47
+
48
+PROMPT=$'\n$(ssh_connection)%{$fg_bold[green]%}%n@%m%{$reset_color%}$(my_git_prompt) : %~\n%# '
49
+
50
+ZSH_THEME_PROMPT_RETURNCODE_PREFIX="%{$fg_bold[red]%}"
51
+ZSH_THEME_GIT_PROMPT_PREFIX=" $fg[white]‹ %{$fg_bold[yellow]%}"
52
+ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg_bold[magenta]%}↑"
53
+ZSH_THEME_GIT_PROMPT_STAGED="%{$fg_bold[green]%}●"
54
+ZSH_THEME_GIT_PROMPT_UNSTAGED="%{$fg_bold[red]%}●"
55
+ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg_bold[white]%}●"
56
+ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg_bold[red]%}✕"
57
+ZSH_THEME_GIT_PROMPT_SUFFIX=" $fg_bold[white]›%{$reset_color%}"