local map = vim.keymap.set require("gitsigns").setup({ signs = { add = { text = "+" }, delete = { text = "-" }, change = { text = "~" }, changedelete = { text = "⋍" }, }, on_attach = function(buf) local gs = package.loaded.gitsigns local opts = { buffer = buf, expr = true, replace_keycodes = false } -- Navigation map("n", "]c", "&diff ? ']c' : 'Gitsigns next_hunk'", opts) map("n", "[c", "&diff ? '[c' : 'Gitsigns prev_hunk'", opts) -- Actions map({ "n", "v" }, "hr", gs.reset_hunk, { buffer = buf }) map({ "n", "v" }, "hs", gs.stage_hunk) map("n", "hS", gs.stage_buffer, { buffer = buf }) map("n", "hp", gs.preview_hunk, { buffer = buf }) -- Text object map({ "o", "x" }, "ih", ":Gitsigns select_hunk", { buffer = buf }) end, })