From 662295b04b96580bcf1c78df9d13dca89adaa454 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Mon, 20 Oct 2025 17:45:21 +0530 Subject: Add git selection line blame --- autoload/git.kak | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'autoload/git.kak') diff --git a/autoload/git.kak b/autoload/git.kak index e0db3c4..20eab1e 100644 --- a/autoload/git.kak +++ b/autoload/git.kak @@ -12,6 +12,7 @@ map global git C ': git add commit --amend' -docstring 'Amend commit' map global git r ': enter-user-mode git-r' -docstring 'Git re(base/set) mode' map global git-r f ': git reset HEAD^1 -- %val{buffile}' -docstring 'Split file out of last commit' +map global git m ': git-line-blame' -docstring 'Blame selection lines' # Hunk map global git n ': git next-hunk' -docstring 'Next hunk' @@ -27,6 +28,14 @@ define-command git-toggle-diff %{ try %{ remove-highlighter window/git-diff } catch %{ git show-diff } catch %{ } } +define-command git-line-blame %{ + evaluate-commands %sh{ + file="${kak_buffile}" + line="$(echo "$kak_selection_desc" | sed -E 's/\.[0-9]+//g')" + echo "terminal sh -c \"git --no-pager log -u -L '$line:$file' --color=always | delta\"" + } +} + # TODO: Toggle this # hook global -group git-diff-if-repo EnterDirectory .* %{ # remove-hooks global git-diff -- cgit v1.3.1