diff --git a/nvim/lua/config/keymaps.lua b/nvim/lua/config/keymaps.lua index 2c134f7..a997467 100644 --- a/nvim/lua/config/keymaps.lua +++ b/nvim/lua/config/keymaps.lua @@ -1,3 +1,28 @@ -- Keymaps are automatically loaded on the VeryLazy event -- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua -- Add any additional keymaps here +local neogit = require("neogit") +local gs = require("gitsigns") + +local function map(mode, lhs, rhs, desc) + vim.keymap.set(mode, lhs, rhs, { desc = desc }) +end + +-- Neogit +map("n", "gg", neogit.open, "Neogit") +vim.keymap.del("n", "gG") +vim.keymap.del("n", "gc") +vim.keymap.del("n", "gs") + +-- Gitsigns +map("n", "gS", gs.stage_buffer, "Stage Buffer") +map("n", "gu", gs.undo_stage_hunk, "Undo Stage Hunk") +map("n", "gR", gs.reset_buffer, "Reset Buffer") +map("n", "gp", gs.preview_hunk, "Preview Hunk") +map("n", "gb", function() + gs.blame_line({ full = true }) +end, "Blame Line") +map("n", "gd", gs.diffthis, "Diff This") +map("n", "gD", function() + gs.diffthis("~") +end, "Diff This ~")