From 6b03f4dc4f29338351b6131d295fa83205a2e701 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sun, 21 Jan 2024 07:56:51 +0100 Subject: [PATCH 1/2] rc tools git: remove redundant try These commands must never fail. --- rc/tools/git.kak | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rc/tools/git.kak b/rc/tools/git.kak index 798fd97d..9f8d5664 100644 --- a/rc/tools/git.kak +++ b/rc/tools/git.kak @@ -365,10 +365,10 @@ define-command -params 1.. \ run_git_blame "$@" ;; hide-blame) - printf %s "try %{ + printf %s " set-option buffer=$kak_bufname git_blame_flags $kak_timestamp remove-highlighter window/git-blame - }" + " ;; show-diff) echo 'try %{ add-highlighter window/git-diff flag-lines Default git_diff_flags }' From 462bf9ff6ae6c449c687bd1290155ac1506bb5b2 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sun, 21 Jan 2024 11:49:47 +0100 Subject: [PATCH 2/2] rc tools git: blame to hide blame if already shown This simplifies the UI (no need to add multiple mappings) and might obsolete hide-blame. --- rc/tools/git.kak | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/rc/tools/git.kak b/rc/tools/git.kak index 9f8d5664..253ab845 100644 --- a/rc/tools/git.kak +++ b/rc/tools/git.kak @@ -62,13 +62,12 @@ define-command -params 1.. \ Available commands: add apply (alias for "patch git apply") - blame + blame (toggle blame annotations) checkout commit diff edit grep - hide-blame hide-diff init log @@ -91,7 +90,6 @@ define-command -params 1.. \ diff \ edit \ grep \ - hide-blame \ hide-diff \ init \ log \ @@ -153,7 +151,18 @@ define-command -params 1.. \ }" } + hide_blame() { + printf %s " + set-option buffer=$kak_bufname git_blame_flags $kak_timestamp + remove-highlighter window/git-blame + " + } + run_git_blame() { + if [ "${kak_opt_git_blame_flags#* *}" != "${kak_opt_git_blame_flags}" ]; then + hide_blame + exit + fi ( cd_bufdir printf %s "evaluate-commands -client '$kak_client' %{ @@ -365,10 +374,7 @@ define-command -params 1.. \ run_git_blame "$@" ;; hide-blame) - printf %s " - set-option buffer=$kak_bufname git_blame_flags $kak_timestamp - remove-highlighter window/git-blame - " + hide_blame ;; show-diff) echo 'try %{ add-highlighter window/git-diff flag-lines Default git_diff_flags }'