From 921457f15e7f91214b5f87b13de2adc931c8b6f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Andr=C3=A9=20Damas?= Date: Mon, 31 Mar 2025 09:36:28 +0100 Subject: [PATCH] change git keybindings --- lua/plugins/diffview.lua | 16 +++++++++++++++- lua/plugins/which-key.nvim.lua | 29 ++++++++++++++++++----------- 2 files changed, 33 insertions(+), 12 deletions(-) diff --git a/lua/plugins/diffview.lua b/lua/plugins/diffview.lua index 30c3b01..ca4dc2c 100644 --- a/lua/plugins/diffview.lua +++ b/lua/plugins/diffview.lua @@ -1,3 +1,17 @@ return { - 'sindrets/diffview.nvim' + 'sindrets/diffview.nvim', + opts = { + keymaps = { + view = { + ["q"] = "DiffviewClose", + }, + file_panel = { + [""] = "DiffviewOpenSelected", + ["q"] = "DiffviewClose", + }, + file_history_panel = { + ["q"] = "DiffviewClose", + }, + }, + } } diff --git a/lua/plugins/which-key.nvim.lua b/lua/plugins/which-key.nvim.lua index 0db5818..b9c29a0 100644 --- a/lua/plugins/which-key.nvim.lua +++ b/lua/plugins/which-key.nvim.lua @@ -131,58 +131,65 @@ return { "[", noremap = false, }, - { "h", group = "git signs" }, + { "g", group = "git signs" }, { - "hs", + "gs", function() require("gitsigns").stage_hunk() end, desc = "Stage hunk", }, { - "hu", + "gu", function() require("gitsigns").undo_stage_hunk() end, desc = "Undo stage hunk", }, { - "hv", + "gv", function() require("gitsigns").preview_hunk() end, desc = "Preview hunk", }, { - "hb", + "gb", function() require("gitsigns").blame_line() end, desc = "Blame line", }, { - "hR", + "gB", + function() + require("gitsigns").blame() + end, + desc = "Blame line", + }, + { + "gR", function() require("gitsigns").reset_buffer() end, desc = "Reset buffer", }, { - "hr", + "gr", function() require("gitsigns").reset_hunk() end, desc = "Reset hunk", }, { - "hS", + "gS", function() require("gitsigns").stage_buffer() end, desc = "Stage buffer", }, { - "hU", + "gU", function() require("gitsigns").reset_buffer_index() end, @@ -191,7 +198,7 @@ return { { mode = "v", { - "hs", + "gs", function() require("gitsigns").stage_hunk({ vim.fn.line("."), vim.fn.line("v") }) @@ -199,7 +206,7 @@ return { desc = "Stage hunk", }, { - "hr", + "gr", function() require("gitsigns").reset_hunk({ vim.fn.line("."), vim.fn.line("v") })