refactor config to define all keybinds in a single file

This commit is contained in:
2024-11-03 17:53:39 -05:00
parent 91ef397420
commit 37969ca98e
11 changed files with 180 additions and 156 deletions
-34
View File
@@ -70,39 +70,5 @@ return {
row = 0,
col = 1,
},
on_attach = function(bufnr)
local gs = package.loaded.gitsigns
local function map(mode, l, r, desc)
vim.keymap.set(mode, l, r, { buffer = bufnr, desc = desc })
end
map("n", "]h", gs.next_hunk, "Next hunk")
map("n", "[h", gs.prev_hunk, "Prev hunk")
map("n", "<leader>hs", gs.stage_hunk, "Stage Hunk")
map("n", "<leader>hr", gs.reset_hunk, "Reset Hunk")
map("v", "<leader>hs", function()
gs.stage_hunk { vim.fn.line ".", vim.fn.line "v" }
end, "Reset Hunk")
map("n", "<leader>hS", gs.stage_buffer, "Stage buffer")
map("n", "<leader>hR", gs.reset_buffer, "Reset buffer")
map("n", "<leader>hu", gs.undo_stage_hunk, "Undo stage hunk")
map("n", "<leader>hp", gs.preview_hunk, "Preview hunk")
map("n", "<leader>hb", function()
gs.blame_line { full = true }
end, "Blame line")
map("n", "<leader>hB", gs.toggle_current_line_blame, "Toggle line blame")
map("n", "<leader>hd", gs.diffthis, "Diff this")
map("n", "<leader>hD", function()
gs.diffthis "~"
end, "Diff this ~")
map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>", "Gitsigns select hunk")
end,
},
}