From 551674875d6f26fe36112f166c11563c24c86416 Mon Sep 17 00:00:00 2001 From: Maxim Baz Date: Mon, 2 Jul 2018 22:34:28 +0200 Subject: [PATCH] Don't swallow stderr, don't update diff when not in git repo, use underlined ~ symbol --- rc/extra/git-tools.kak | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rc/extra/git-tools.kak b/rc/extra/git-tools.kak index d4ce420f..5ab394ef 100644 --- a/rc/extra/git-tools.kak +++ b/rc/extra/git-tools.kak @@ -97,7 +97,8 @@ Available commands:\n add\n rm\n blame\n commit\n checkout\n diff\n hide- } update_diff() { - git --no-pager diff -U0 "$kak_buffile" 2>/dev/null | perl -e ' + git rev-parse --show-toplevel >/dev/null 2>&1 || return + git --no-pager diff -U0 "$kak_buffile" | perl -e ' $flags = $ENV{"kak_timestamp"}; foreach $line () { if ($line =~ /@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))?/) { @@ -141,7 +142,7 @@ Available commands:\n add\n rm\n blame\n commit\n checkout\n diff\n hide- $flags .= ":$line|\{blue\}~"; } $last = $to_line + $to_count - 1; - $flags .= ":$last|\{blue\}~_"; + $flags .= ":$last|\{blue+u\}~"; } } }