8f3737f45b4c3c05e1488a28f79c6bc29ad8fb32

Author
Marc Cornellà <marc.cornella@live.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

Revert fbcda4d

The PROMPT building method clashes with other themes and
plugins that modify the PROMPT variable.

Also reverted the $jobstates trick due to it not working
inside $PROMPT.

Diff

This diff is truncated to protect this page.

  1diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme
  2old mode 100755
  3new mode 100644
  4index 292551f4405e4b7f713c8c4dc0566b12b0d6a89a..b0a794f4da68b871dc99a0f33b6cde82415e96cc
  5--- a/themes/agnoster.zsh-theme
  6+++ b/themes/agnoster.zsh-theme
  7@@ -29,7 +29,6 @@
  8 # A few utility functions to make it easy and re-usable to draw segmented prompts
  9 
 10 CURRENT_BG='NONE'
 11-zmodload zsh/parameter
 12 
 13 # Special Powerline characters
 14 
 15@@ -56,23 +55,23 @@ prompt_segment() {
 16   [[ -n $1 ]] && bg="%K{$1}" || bg="%k"
 17   [[ -n $2 ]] && fg="%F{$2}" || fg="%f"
 18   if [[ $CURRENT_BG != 'NONE' && $1 != $CURRENT_BG ]]; then
 19-    PROMPT+=" %{$bg%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR%{$fg%} "
 20+    echo -n " %{$bg%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR%{$fg%} "
 21   else
 22-    PROMPT+="%{$bg%}%{$fg%} "
 23+    echo -n "%{$bg%}%{$fg%} "
 24   fi
 25   CURRENT_BG=$1
 26-  [[ -n $3 ]] && PROMPT+=$3
 27+  [[ -n $3 ]] && echo -n $3
 28 }
 29 
 30 # End the prompt, closing any open segments
 31 prompt_end() {
 32   if [[ -n $CURRENT_BG ]]; then
 33-    PROMPT+=" %{%k%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR"
 34+    echo -n " %{%k%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR"
 35   else
 36-    PROMPT+="%{%k%}"
 37+    echo -n "%{%k%}"
 38   fi
 39-  PROMPT+="%{%f%}"
 40-  CURRENT_BG='NONE'
 41+  echo -n "%{%f%}"
 42+  CURRENT_BG=''
 43 }
 44 
 45 ### Prompt components
 46@@ -124,7 +123,7 @@ prompt_git() {
 47     zstyle ':vcs_info:*' formats ' %u%c'
 48     zstyle ':vcs_info:*' actionformats ' %u%c'
 49     vcs_info
 50-    PROMPT+="${ref/refs\/heads\//$PL_BRANCH_CHAR }${vcs_info_msg_0_%% }${mode}"
 51+    echo -n "${ref/refs\/heads\//$PL_BRANCH_CHAR }${vcs_info_msg_0_%% }${mode}"
 52   fi
 53 }
 54 
 55@@ -136,15 +135,15 @@ prompt_bzr() {
 56         revision=`bzr log | head -n2 | tail -n1 | sed 's/^revno: //'`
 57         if [[ $status_mod -gt 0 ]] ; then
 58             prompt_segment yellow black
 59-            PROMPT+="bzr@$revision ✚ "
 60+            echo -n "bzr@"$revision "✚ "
 61         else
 62             if [[ $status_all -gt 0 ]] ; then
 63                 prompt_segment yellow black
 64-                PROMPT+="bzr@$revision"
 65+                echo -n "bzr@"$revision
 66 
 67             else
 68                 prompt_segment green black
 69-                PROMPT+="bzr@$revision"
 70+                echo -n "bzr@"$revision
 71             fi
 72         fi
 73     fi
 74@@ -158,30 +157,30 @@ prompt_hg() {
 75       if [[ $(hg prompt "{status|unknown}") = "?" ]]; then
 76         # if files are not added
 77         prompt_segment red white
 78-        st=' ±'
 79+        st='±'
 80       elif [[ -n $(hg prompt "{status|modified}") ]]; then
 81         # if any modification
 82         prompt_segment yellow black
 83-        st=' ±'
 84+        st='±'
 85       else
 86         # if working copy is clean
 87         prompt_segment green black
 88       fi
 89-      PROMPT+="$(hg prompt "☿ {rev}@{branch}")$st"
 90+      echo -n $(hg prompt "☿ {rev}@{branch}") $st
 91     else
 92       st=""
 93       rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g')
 94       branch=$(hg id -b 2>/dev/null)
 95       if `hg st | grep -q "^\?"`; then
 96         prompt_segment red black
 97-        st=' ±'
 98+        st='±'
 99       elif `hg st | grep -q "^[MA]"`; then
100         prompt_segment yellow black
101-        st=' ±'
102+        st='±'
103       else
104         prompt_segment green black
105       fi
106-      PROMPT+="☿ $rev@$branch$st"