Browse code

Added my own theme based on pat's

Josh Price authored on 17/08/2010 at 12:45:10
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,43 @@
0
+grey='\e[0;90m'
1
+
2
+ZSH_THEME_GIT_PROMPT_PREFIX="%{$grey%}("
3
+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
4
+ZSH_THEME_GIT_PROMPT_DIRTY="%{$grey%}) %{$fg[yellow]%}✗%{$reset_color%}"
5
+ZSH_THEME_GIT_PROMPT_CLEAN="%{$grey%})"
6
+
7
+function pat_prompt {
8
+  (( spare_width = ${COLUMNS} ))
9
+  prompt=" "
10
+
11
+  branch=$(current_branch)
12
+  ruby_version=$(rvm_prompt_info)
13
+  path_size=${#PWD}
14
+  branch_size=${#branch}
15
+  ruby_size=${#ruby_version}
16
+  machine_size=11
17
+  
18
+  if [[ ${#branch} -eq 0 ]]
19
+    then (( ruby_size = ruby_size + 1 ))
20
+  else
21
+    (( branch_size = branch_size + 4 ))
22
+    if [[ -n $(git status -s 2> /dev/null) ]]; then
23
+      (( branch_size = branch_size + 2 ))
24
+    fi
25
+  fi
26
+  
27
+  (( spare_width = ${spare_width} - (${machine_size} + ${path_size} + ${branch_size} + ${ruby_size}) ))
28
+
29
+  while [ ${#prompt} -lt $spare_width ]; do
30
+    prompt=" $prompt"
31
+  done
32
+  
33
+  prompt="%{%F{green}%}$PWD$prompt%{%F{red}%}$(rvm_prompt_info)%{$reset_color%} $(git_prompt_info)"
34
+  
35
+  echo $prompt
36
+}
37
+
38
+setopt prompt_subst
39
+
40
+PROMPT='
41
+%n@%m $(pat_prompt)
42
+%(?,%{%F{green}%},%{%F{red}%})⚡%{$reset_color%} '