From 1ec0c5c742368864a32c7a7199b692e5527611e6 Mon Sep 17 00:00:00 2001 From: Jonathan Dahan Date: Thu, 29 May 2014 17:16:00 +0200 Subject: [PATCH] Close GH-67: provide arrows for push and pull. --- pure.zsh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pure.zsh b/pure.zsh index ac2560e..fc7f573 100644 --- a/pure.zsh +++ b/pure.zsh @@ -80,10 +80,12 @@ prompt_pure_precmd() { # check check if there is anything to pull command git fetch &>/dev/null && # check if there is an upstream configured for this branch - command git rev-parse --abbrev-ref @'{u}' &>/dev/null && - (( $(command git rev-list --right-only --count HEAD...@'{u}' 2>/dev/null) > 0 )) && - # some crazy ansi magic to inject the symbol into the previous line - print -Pn "\e7\e[A\e[1G\e[`prompt_pure_string_length $prompt_pure_preprompt`C%F{cyan}⇣%f\e8" + command git rev-parse --abbrev-ref @'{u}' &>/dev/null && { + local arrows='' + (( $(command git rev-list --right-only --count HEAD...@'{u}' 2>/dev/null) > 0 )) && arrows='⇣' + (( $(command git rev-list --left-only --count HEAD...@'{u}' 2>/dev/null) > 0 )) && arrows+='⇡' + print -Pn "\e7\e[A\e[1G\e[`prompt_pure_string_length $prompt_pure_preprompt`C%F{cyan}${arrows}%f\e8" + } } &! # reset value since `preexec` isn't always triggered