(local map vim.keymap.set)
(local api vim.api)
(fn print-blame-text []
(let [curfile (vim.fn.expand "%")
line (api.nvim_win_get_cursor 0)
blame (vim.fn.system (string.format "git blame -c -L %d,%d %s" (. line 1) (. line 1) curfile))
hash (string.match blame "%S+")]
(print (if (= hash " 00000000")
"Not Committed Yet"
(let [cmd (.. "git show " hash " --format='%an | %ar | %s' | head -n 1")]
(: (vim.fn.system cmd) :sub 1 -2))))))
(map "n" "\\b" print-blame-text)
nil