From b22831b7e25a4681df171da30204d4d4f7e9abfa Mon Sep 17 00:00:00 2001 From: Iordanis Petkakis <12776461+dpetka2001@users.noreply.github.com> Date: Fri, 21 Jun 2024 22:14:48 +0300 Subject: [PATCH] feat(gitsigns): new keymap for `Gitsigns blame` (#3758) Also add filetype `gitsigns.blame` to autocmd `lazyvim_close_with_q` and workaround for `+hunks` group name to show prefix correctly. If you don't like the workaround for `+hunks` group name feel free to remove it. ## What is this PR for? Make use of the new `gitsigns` feature `Gitsigns blame`, which shows in a vertical buffer split the `blame` history of the whole buffer. ## Does this PR fix an existing issue? No. ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --- lua/lazyvim/config/autocmds.lua | 1 + lua/lazyvim/plugins/editor.lua | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/config/autocmds.lua b/lua/lazyvim/config/autocmds.lua index 2fc283ba..81d0209a 100644 --- a/lua/lazyvim/config/autocmds.lua +++ b/lua/lazyvim/config/autocmds.lua @@ -67,6 +67,7 @@ vim.api.nvim_create_autocmd("FileType", { "neotest-summary", "neotest-output-panel", "dbout", + "gitsigns.blame", }, callback = function(event) vim.bo[event.buf].buflisted = false diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index 05fe5c25..b80c0d8f 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -177,7 +177,7 @@ return { ["c"] = { name = "+code" }, ["f"] = { name = "+file/find" }, ["g"] = { name = "+git" }, - ["gh"] = { name = "+hunks" }, + ["gh"] = { name = "+hunks", ["_"] = "which_key_ignore" }, ["q"] = { name = "+quit/session" }, ["s"] = { name = "+search" }, ["u"] = { name = "+ui" }, @@ -226,6 +226,7 @@ return { map("n", "ghR", gs.reset_buffer, "Reset Buffer") map("n", "ghp", gs.preview_hunk_inline, "Preview Hunk Inline") map("n", "ghb", function() gs.blame_line({ full = true }) end, "Blame Line") + map("n", "ghB", function() gs.blame() end, "Blame Buffer") map("n", "ghd", gs.diffthis, "Diff This") map("n", "ghD", function() gs.diffthis("~") end, "Diff This ~") map({ "o", "x" }, "ih", ":Gitsigns select_hunk", "GitSigns Select Hunk")