return { { "lewis6991/gitsigns.nvim", event = { "BufReadPre", "BufNewFile" }, opts = { on_attach = function(buf) local gs = require("gitsigns") local function map(mode, lhs, rhs, desc) vim.keymap.set(mode, lhs, rhs, { buffer = buf, desc = desc }) end map("n", "gs", gs.stage_hunk, "Stage hunk") map("n", "gr", gs.reset_hunk, "Reset hunk") map("x", "gs", function() gs.stage_hunk({ vim.fn.line("."), vim.fn.line("v") }) end, "Stage selection") map("x", "gr", function() gs.reset_hunk({ vim.fn.line("."), vim.fn.line("v") }) end, "Reset selection") map("n", "gb", gs.blame_line, "Blame line") map("n", "gt", gs.toggle_current_line_blame, "Toggle line blame") map("n", "gS", gs.stage_buffer, "Stage buffer") map("n", "gR", gs.reset_buffer, "Reset buffer") -- Hunk navigation without [ and ] (QWERTZ) map("n", "h", function() gs.nav_hunk("next") end, "Next hunk") map("n", "H", function() gs.nav_hunk("prev") end, "Previous hunk") map("n", "gp", gs.preview_hunk, "Preview hunk") end, }, }, }