1582570919b5bed145d38d1d60ae8572f4552f25

Author
Josh Price <joshcp@gmail.com>
Committer
Robby Russell <robby@planetargon.com>
Date

Message

Made the user_machine_size calculation generic. Pwned the function name.

Diff

 1diff --git a/themes/josh.zsh-theme b/themes/josh.zsh-theme
 2index 9d59bd91ec1a6deb277439ab0ee3456adc59c861..6bed1a70e46716437afb494ed699c724bd8df670 100644
 3--- a/themes/josh.zsh-theme
 4+++ b/themes/josh.zsh-theme
 5@@ -5,7 +5,7 @@ ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
 6 ZSH_THEME_GIT_PROMPT_DIRTY="%{$grey%}) %{$fg[yellow]%}✗%{$reset_color%}"
 7 ZSH_THEME_GIT_PROMPT_CLEAN="%{$grey%})"
 8 
 9-function pat_prompt {
10+function josh_prompt {
11   (( spare_width = ${COLUMNS} ))
12   prompt=" "
13 
14@@ -14,7 +14,7 @@ function pat_prompt {
15   path_size=${#PWD}
16   branch_size=${#branch}
17   ruby_size=${#ruby_version}
18-  machine_size=11
19+  user_machine_size=${#${(%):-%n@%m-}}
20   
21   if [[ ${#branch} -eq 0 ]]
22     then (( ruby_size = ruby_size + 1 ))
23@@ -25,7 +25,7 @@ function pat_prompt {
24     fi
25   fi
26   
27-  (( 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 
30   while [ ${#prompt} -lt $spare_width ]; do
31     prompt=" $prompt"
32@@ -39,5 +39,5 @@ function pat_prompt {
33 setopt prompt_subst
34 
35 PROMPT='
36-%n@%m $(pat_prompt)
37+%n@%m $(josh_prompt)
38 %(?,%{%F{green}%},%{%F{red}%})⚡%{$reset_color%} '