From 24bf123503c06c44e73892aaf1ae550ae11af66e Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sat, 3 Feb 2024 00:26:57 +0100 Subject: [PATCH] rc tools git: while blame annotations are shown, map to "git blame-jump" Running git blame signals intent to view the blamed commit. Let's make `` to go to that commit+line as long as blame info is shown. In diff buffers we already use `` for "diff-jump". Like blame annotations, the blame-jump mapping lives in window scope. This means it will not collide with "diff-jump" which is mapped in buffer scope. Add the mapping synchronously (unlike the rest of the git-blame code) to perhaps allow the user to override the mapping: git blame; map window normal ... --- rc/tools/git.kak | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/rc/tools/git.kak b/rc/tools/git.kak index d7e251860..80af81e0e 100644 --- a/rc/tools/git.kak +++ b/rc/tools/git.kak @@ -167,6 +167,7 @@ define-command -params 1.. \ printf %s "evaluate-commands -try-client '$kak_opt_docsclient' ' edit! -fifo ${output} *git* set-option buffer filetype ${filetype} + $(hide_blame) hook -always -once buffer BufCloseFifo .* '' nop %sh{ rm -r $(dirname ${output}) } $(printf %s "${on_close_fifo}" | sed "s/'/''''/g") @@ -176,9 +177,10 @@ define-command -params 1.. \ hide_blame() { printf %s " - set-option buffer=$kak_bufname git_blame_flags $kak_timestamp - set-option buffer=$kak_bufname git_blame '' + set-option buffer git_blame_flags $kak_timestamp + set-option buffer git_blame %{} remove-highlighter window/git-blame + unmap window normal %{:git blame-jump} " } @@ -204,6 +206,8 @@ define-command -params 1.. \ }" eval $(cat ${kak_response_fifo}) eval "$prepare_git_blame_args" + echo 'map window normal %{:git blame-jump}' + echo 'echo -markup {Information}Press to jump to blamed commit' ( cd_bufdir printf %s "evaluate-commands -client '$kak_client' %{