d5bfbf05d16634fa3c2834c7097edb1cf2487d96

Author
clutton <clutton0@gmail.com>
Committer
clutton <clutton0@gmail.com>
Date

Message

improvement: define PROMPT_HOST once on startup

Diff

 1diff --git a/themes/jnrowe.zsh-theme b/themes/jnrowe.zsh-theme
 2index 0ade9cc60ebc48d9518cc234f1827a0e51038327..a1478be31ca8e538769246e22bba3330d81dc3c8 100644
 3--- a/themes/jnrowe.zsh-theme
 4+++ b/themes/jnrowe.zsh-theme
 5@@ -1,16 +1,14 @@
 6-autoload -U colors && colors
 7 autoload -U add-zsh-hook
 8 autoload -Uz vcs_info
 9 
10+zstyle ':vcs_info:*' disable-patterns "/usr/(ports|src)(|/*)"
11 zstyle ':vcs_info:*' actionformats \
12-    '%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f '
13-zstyle ':vcs_info:*' formats \
14-    '%F{2}%s%F{7}:%F{2}(%F{1}%b%F{2})%f '
15+       '%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f '
16+zstyle ':vcs_info:*' formats '%F{2}%s%F{7}:%F{2}(%F{1}%b%F{2})%f '
17 zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r'
18 zstyle ':vcs_info:*' enable git
19 
20 add-zsh-hook precmd prompt_vcs
21-add-zsh-hook precmd prompt_host
22 
23 prompt_vcs () {
24     vcs_info
25@@ -26,17 +24,16 @@ prompt_vcs () {
26     fi
27 }
28 
29-prompt_host () {
30+function {
31     if [[ -n "$SSH_CLIENT" ]]; then
32-        host=" ($HOST)"
33+        PROMPT_HOST=" ($HOST)"
34     else
35-        host=''
36+        PROMPT_HOST=''
37     fi
38 }
39 
40-
41 local ret_status="%(?:%{$fg_bold[green]%}Ξ:%{$fg_bold[red]%}%S↑%s%?)"
42 
43-PROMPT='${ret_status}%{$fg[blue]%}${host}%{$fg_bold[green]%}%p %{$fg_bold[yellow]%}%2~ ${vcs_info_msg_0_}${dir_status}%{$reset_color%} '
44+PROMPT='${ret_status}%{$fg[blue]%}${PROMPT_HOST}%{$fg_bold[green]%}%p %{$fg_bold[yellow]%}%2~ ${vcs_info_msg_0_}${dir_status}%{$reset_color%} '
45 
46 #  vim: set ft=zsh ts=4 sw=4 et: