return { { "lewis6991/gitsigns.nvim", config = function() -- Git hunk navigation local gs = require("gitsigns") gs.setup({ signs_staged_enable = true, signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` numhl = true, -- Toggle with `:Gitsigns toggle_numhl` linehl = false, -- Toggle with `:Gitsigns toggle_linehl` word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` current_line_blame_opts = { virt_text_pos = 'right_align', -- 'eol' | 'overlay' | 'right_align' }, -- current_line_blame = true, -- current_line_blame_formatter = ', - ', }) vim.keymap.set("n", "[g", gs.prev_hunk, { desc = "Goto previous git hunk" }) vim.keymap.set("n", "]g", gs.next_hunk, { desc = "Goto next git hunk" }) -- vim.keymap.set("n", "cg", gitsigns.preview_hunk, { desc = "Preview git hunk" }) vim.keymap.set("n", "gd", function() gs.preview_hunk_inline() end, { desc = "Preview hunk inline" }) vim.keymap.set("n", "gD", function() gs.preview_hunk() end, { desc = "Preview hunk popup" }) vim.keymap.set("n", "gf", function() gs.diffthis() end, { desc = "Diff file" }) vim.keymap.set("n", "gr", function() gs.reset_hunk() end, { desc = "Revert hunk" }) vim.keymap.set("n", "gs", function() gs.stage_hunk() end, { desc = "Stage hunk" }) vim.keymap.set("n", "ga", function() gs.stage_buffer() end, { desc = "Stage buffer" }) vim.keymap.set("n", "gB", function() gs.toggle_current_line_blame() end, { desc = "Toggle current line blame (virtual text)" }) vim.keymap.set("n", "gb", function() gs.blame() end, { desc = "Open blame" }) -- Select hunks as a text object. vim.keymap.set({'o', 'x'}, 'ih', 'Gitsigns select_hunk') -- Open current file/line (or visual selection) on the git remote vim.keymap.set({ "n", "x" }, "go", function() Snacks.gitbrowse() end, { desc = "Open in remote (browser)" }) end, }, -- Lazy-loaded: kept only for its `:Git ` escape hatch and :Gblame, -- since neogit + diffview + gitsigns cover day-to-day staging/diff/blame. { "tpope/vim-fugitive", cmd = { "Git", "G", "Gdiffsplit", "Gread", "Gwrite", "Gedit", "Gblame", "Gclog" }, }, { "NeogitOrg/neogit", lazy = true, dependencies = { "nvim-lua/plenary.nvim", -- required "sindrets/diffview.nvim", -- optional - Diff integration -- Only one of these is needed. "ibhagwan/fzf-lua", -- optional -- "nvim-telescope/telescope.nvim", -- optional -- "nvim-mini/mini.pick", -- optional -- "folke/snacks.nvim", -- optional }, cmd = "Neogit", keys = { { "gg", "Neogit", desc = "Show Neogit UI" } } }, }