Browse code

Merge pull request #415 from eproxus/master

New theme: sunrise

Robby Russell authored on 18/07/2011 at 05:02:43
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,96 @@
0
+#-------------------------------------------------------------------------------
1
+# Sunrise theme for oh-my-zsh by Adam Lindberg (eproxus@gmail.com)
2
+# Intended to be used with Solarized: http://ethanschoonover.com/solarized
3
+# (Needs Git plugin for current_branch method)
4
+#-------------------------------------------------------------------------------
5
+
6
+# Color shortcuts
7
+R=$fg[red]
8
+G=$fg[green]
9
+M=$fg[magenta]
10
+RB=$fg_bold[red]
11
+YB=$fg_bold[yellow]
12
+BB=$fg_bold[blue]
13
+RESET=$reset_color
14
+
15
+if [ "$(whoami)" = "root" ]; then
16
+    PROMPTCOLOR="%{$RB%}" PREFIX="-!-";
17
+else
18
+    PROMPTCOLOR="" PREFIX="---";
19
+fi
20
+
21
+local return_code="%(?..%{$R%}%? ↵%{$RESET%})"
22
+
23
+# Get the status of the working tree (copied and modified from git.zsh)
24
+custom_git_prompt_status() {
25
+  INDEX=$(git status --porcelain 2> /dev/null)
26
+  STATUS=""
27
+  # Non-staged
28
+  if $(echo "$INDEX" | grep '^?? ' &> /dev/null); then
29
+    STATUS="$ZSH_THEME_GIT_PROMPT_UNTRACKED$STATUS"
30
+  fi
31
+  if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then
32
+    STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS"
33
+  fi
34
+  if $(echo "$INDEX" | grep '^ D ' &> /dev/null); then
35
+    STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
36
+  fi
37
+  if $(echo "$INDEX" | grep '^.M ' &> /dev/null); then
38
+    STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
39
+  elif $(echo "$INDEX" | grep '^AM ' &> /dev/null); then
40
+    STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
41
+  elif $(echo "$INDEX" | grep '^ T ' &> /dev/null); then
42
+    STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
43
+  fi
44
+  # Staged
45
+  if $(echo "$INDEX" | grep '^D  ' &> /dev/null); then
46
+    STATUS="$ZSH_THEME_GIT_PROMPT_STAGED_DELETED$STATUS"
47
+  fi
48
+  if $(echo "$INDEX" | grep '^R' &> /dev/null); then
49
+    STATUS="$ZSH_THEME_GIT_PROMPT_STAGED_RENAMED$STATUS"
50
+  fi
51
+  if $(echo "$INDEX" | grep '^M' &> /dev/null); then
52
+    STATUS="$ZSH_THEME_GIT_PROMPT_STAGED_MODIFIED$STATUS"
53
+  fi
54
+  if $(echo "$INDEX" | grep '^A' &> /dev/null); then
55
+    STATUS="$ZSH_THEME_GIT_PROMPT_STAGED_ADDED$STATUS"
56
+  fi
57
+
58
+  if $(echo -n "$STATUS" | grep '.*' &> /dev/null); then
59
+    STATUS="$ZSH_THEME_GIT_STATUS_PREFIX$STATUS"
60
+  fi
61
+
62
+  echo $STATUS
63
+}
64
+
65
+# get the name of the branch we are on (copied and modified from git.zsh)
66
+function custom_git_prompt() {
67
+  ref=$(git symbolic-ref HEAD 2> /dev/null) || return
68
+  echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$(git_prompt_ahead)$(custom_git_prompt_status)$ZSH_THEME_GIT_PROMPT_SUFFIX"
69
+}
70
+
71
+# %B sets bold text
72
+PROMPT='%B$PREFIX %2~ $(custom_git_prompt)%{$M%}%B»%b%{$RESET%} '
73
+RPS1="${return_code}"
74
+
75
+ZSH_THEME_GIT_PROMPT_PREFIX="%{$YB%}‹"
76
+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$YB%}›%{$RESET%} "
77
+
78
+ZSH_THEME_GIT_PROMPT_DIRTY="%{$R%}*"
79
+ZSH_THEME_GIT_PROMPT_CLEAN=""
80
+
81
+ZSH_THEME_GIT_PROMPT_AHEAD="%{$BB%}➔"
82
+
83
+ZSH_THEME_GIT_STATUS_PREFIX=" "
84
+
85
+# Staged
86
+ZSH_THEME_GIT_PROMPT_STAGED_ADDED="%{$G%}A"
87
+ZSH_THEME_GIT_PROMPT_STAGED_MODIFIED="%{$G%}M"
88
+ZSH_THEME_GIT_PROMPT_STAGED_RENAMED="%{$G%}R"
89
+ZSH_THEME_GIT_PROMPT_STAGED_DELETED="%{$G%}D"
90
+
91
+# Not-staged
92
+ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$R%}⁇"
93
+ZSH_THEME_GIT_PROMPT_MODIFIED="%{$R%}M"
94
+ZSH_THEME_GIT_PROMPT_DELETED="%{$R%}D"
95
+ZSH_THEME_GIT_PROMPT_UNMERGED="%{$R%}UU"