return { -- Fugitive { "tpope/vim-fugitive", event = { "BufReadPost", "BufNewFile", "BufWritePre" }, config = function() local function map(mode, l, r, desc) vim.keymap.set(mode, l, r, { silent = true, noremap = true, desc = desc }) end map("n", "gs", "Git", "Git Status") map("n", "gd", "Gvdiffsplit!", "Git Diff") map("n", "gbl", "Git blame", "Git Blame") map("n", "gc", "Git commit", "Git Commit") map("n", "gC", "Git commit --amend", "Git Commit Amend") map("n", "gp", "Git push", "Git Push") map("n", "gS", "Git push --set-upstream origin $(git rev-parse --abbrev-ref HEAD)", "Git Push Set Upstream") map("n", "gbs", "Git bisect start", "Git Bisect Start") map("n", "gbg", "Git bisect good", "Git Bisect Good") map("n", "gbb", "Git bisect bad", "Git Bisect Bad") map("n", "gbr", "Git bisect reset", "Git Bisect Reset") end }, -- Gitsigns { "lewis6991/gitsigns.nvim", event = { "BufReadPost", "BufNewFile", "BufWritePre", "VeryLazy" }, opts = { signs = { add = { text = "▎" }, change = { text = "▎" }, delete = { text = "" }, topdelete = { text = "" }, changedelete = { text = "▎" }, untracked = { text = "▎" }, }, on_attach = function(buffer) local gs = package.loaded.gitsigns local function map(mode, l, r, desc) vim.keymap.set(mode, l, r, { buffer = buffer, desc = desc }) end map("n", "]h", gs.next_hunk, "Next Hunk") map("n", "[h", gs.prev_hunk, "Prev Hunk") map({ "n", "v" }, "ghs", "Gitsigns stage_hunk", "Stage Hunk") map({ "n", "v" }, "ghr", "Gitsigns reset_hunk", "Reset Hunk") map("n", "ghS", gs.stage_buffer, "Stage Buffer") map("n", "ghu", gs.undo_stage_hunk, "Undo Stage Hunk") map("n", "ghR", gs.reset_buffer, "Reset Buffer") map("n", "ghp", gs.preview_hunk, "Preview Hunk") map("n", "ghb", function() gs.blame_line({ full = true }) end, "Blame Line") map("n", "ghd", gs.diffthis, "Diff This") map("n", "ghD", function() gs.diffthis("~") end, "Diff This ~") map({ "o", "x" }, "ih", ":Gitsigns select_hunk", "GitSigns Select Hunk") end, }, }, }