Browse code

Made the user_machine_size calculation generic. Pwned the function name.

Josh Price authored on 17/08/2010 at 13:22:26
Showing 1 changed files
... ...
@@ -5,7 +5,7 @@ ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
5 5
 ZSH_THEME_GIT_PROMPT_DIRTY="%{$grey%}) %{$fg[yellow]%}✗%{$reset_color%}"
6 6
 ZSH_THEME_GIT_PROMPT_CLEAN="%{$grey%})"
7 7
 
8
-function pat_prompt {
8
+function josh_prompt {
9 9
   (( spare_width = ${COLUMNS} ))
10 10
   prompt=" "
11 11
 
... ...
@@ -14,7 +14,7 @@ function pat_prompt {
14 14
   path_size=${#PWD}
15 15
   branch_size=${#branch}
16 16
   ruby_size=${#ruby_version}
17
-  machine_size=11
17
+  user_machine_size=${#${(%):-%n@%m-}}
18 18
   
19 19
   if [[ ${#branch} -eq 0 ]]
20 20
     then (( ruby_size = ruby_size + 1 ))
... ...
@@ -25,7 +25,7 @@ function pat_prompt {
25 25
     fi
26 26
   fi
27 27
   
28
-  (( spare_width = ${spare_width} - (${machine_size} + ${path_size} + ${branch_size} + ${ruby_size}) ))
28
+  (( spare_width = ${spare_width} - (${user_machine_size} + ${path_size} + ${branch_size} + ${ruby_size}) ))
29 29
 
30 30
   while [ ${#prompt} -lt $spare_width ]; do
31 31
     prompt=" $prompt"
... ...
@@ -39,5 +39,5 @@ function pat_prompt {
39 39
 setopt prompt_subst
40 40
 
41 41
 PROMPT='
42
-%n@%m $(pat_prompt)
42
+%n@%m $(josh_prompt)
43 43
 %(?,%{%F{green}%},%{%F{red}%})⚡%{$reset_color%} '