From 7b440b2e851c9165cc28bd1bdc3856e0b7781165 Mon Sep 17 00:00:00 2001 From: Dan Burkert Date: Fri, 18 Jan 2013 21:16:48 -0500 Subject: [PATCH 1/2] Update agnoster to use new powerline codepoints See https://github.com/Lokaltog/powerlin://github.com/Lokaltog/powerline and http://lokaltog.github.com/powerline/fontpatching.html --- themes/agnoster.zsh-theme | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme index c3107c06c..b37a325b9 100644 --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -26,7 +26,7 @@ # A few utility functions to make it easy and re-usable to draw segmented prompts CURRENT_BG='NONE' -SEGMENT_SEPARATOR='⮀' +SEGMENT_SEPARATOR='' # Begin a segment # Takes two arguments, background and foreground. Both can be omitted, @@ -79,7 +79,7 @@ prompt_git() { else prompt_segment green black fi - echo -n "${ref/refs\/heads\//⭠ }$dirty" + echo -n "${ref/refs\/heads\// }$dirty" fi } From 3dad43831261fdaf14d7c99d9e5f4a9772472a79 Mon Sep 17 00:00:00 2001 From: Devin Christensen Date: Wed, 1 May 2013 13:32:48 -0600 Subject: [PATCH 2/2] Default to old powerline and make configurable --- themes/agnoster.zsh-theme | 76 +++++++++++++++++++++------------------ 1 file changed, 42 insertions(+), 34 deletions(-) diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme index 2f6810ec7..192e32ec0 100644 --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -26,7 +26,15 @@ # A few utility functions to make it easy and re-usable to draw segmented prompts CURRENT_BG='NONE' -SEGMENT_SEPARATOR='' + +if [ "x$USE_NEW_POWERLINE" = "xtrue" ]; then + SEGMENT_SEPARATOR='' + BRANCH_SYMBOL='' +else + SEGMENT_SEPARATOR='⮀' + BRANCH_SYMBOL='⭠' +fi + # Begin a segment # Takes two arguments, background and foreground. Both can be omitted, @@ -90,43 +98,43 @@ prompt_git() { zstyle ':vcs_info:*' formats ' %u%c' zstyle ':vcs_info:*' actionformats '%u%c' vcs_info - echo -n "${ref/refs\/heads\// }${vcs_info_msg_0_}" + echo -n "${ref/refs\/heads\//$BRANCH_SYMBOL }${vcs_info_msg_0_}" fi } prompt_hg() { - local rev status - if $(hg id >/dev/null 2>&1); then - if $(hg prompt >/dev/null 2>&1); then - if [[ $(hg prompt "{status|unknown}") = "?" ]]; then - # if files are not added - prompt_segment red white - st='±' - elif [[ -n $(hg prompt "{status|modified}") ]]; then - # if any modification - prompt_segment yellow black - st='±' - else - # if working copy is clean - prompt_segment green black - fi - echo -n $(hg prompt "⭠ {rev}@{branch}") $st - else - st="" - rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g') - branch=$(hg id -b 2>/dev/null) - if `hg st | grep -Eq "^\?"`; then - prompt_segment red black - st='±' - elif `hg st | grep -Eq "^(M|A)"`; then - prompt_segment yellow black - st='±' - else - prompt_segment green black - fi - echo -n "⭠ $rev@$branch" $st - fi - fi + local rev status + if $(hg id >/dev/null 2>&1); then + if $(hg prompt >/dev/null 2>&1); then + if [[ $(hg prompt "{status|unknown}") = "?" ]]; then + # if files are not added + prompt_segment red white + st='±' + elif [[ -n $(hg prompt "{status|modified}") ]]; then + # if any modification + prompt_segment yellow black + st='±' + else + # if working copy is clean + prompt_segment green black + fi + echo -n $(hg prompt "$BRANCH_SYMBOL {rev}@{branch}") $st + else + st="" + rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g') + branch=$(hg id -b 2>/dev/null) + if `hg st | grep -Eq "^\?"`; then + prompt_segment red black + st='±' + elif `hg st | grep -Eq "^(M|A)"`; then + prompt_segment yellow black + st='±' + else + prompt_segment green black + fi + echo -n "$BRANCH_SYMBOL $rev@$branch" $st + fi + fi } # Dir: current working directory