return { -- Git integration for buffers -- https://github.com/lewis6991/gitsigns.nvim { 'lewis6991/gitsigns.nvim', config = function() require('gitsigns').setup { signs = { add = { text = '+' }, change = { text = '~' }, delete = { text = '_' }, topdelete = { text = '‾' }, changedelete = { text = '~' }, }, current_line_blame = false, on_attach = function(bufnr) local gs = require 'gitsigns' local function map(mode, l, r, opts) opts = opts or {} opts.buffer = bufnr vim.keymap.set(mode, l, r, opts) end -- Navigation map('n', ']c', function() if vim.wo.diff then return ']c' end vim.schedule(function() gs.next_hunk() end) return '' end, { expr = true }) map('n', '[c', function() if vim.wo.diff then return '[c' end vim.schedule(function() gs.prev_hunk() end) return '' end, { expr = true }) -- Actions map({ 'n', 'v' }, 'hs', ':Gitsigns stage_hunk') map({ 'n', 'v' }, 'hr', ':Gitsigns reset_hunk') map('n', 'hS', gs.stage_buffer) map('n', 'ha', gs.stage_hunk) map('n', 'hu', gs.undo_stage_hunk) map('n', 'hR', gs.reset_buffer) map('n', 'hp', gs.preview_hunk) map('n', 'hb', function() gs.blame_line { full = true } end) map('n', 'tB', gs.toggle_current_line_blame) map('n', 'hd', gs.diffthis) map('n', 'hD', function() gs.diffthis '~' end) -- Text object map({ 'o', 'x' }, 'ih', ':Gitsigns select_hunk') end, } end, }, -- git-worktree.nvim: Manage git worktrees -- https://github.com/ThePrimeagen/git-worktree.nvim { 'ThePrimeagen/git-worktree.nvim', config = function() require('git-worktree').setup() end, }, -- An interactive and powerful Git interface for Neovim, inspired by Magit -- https://github.com/NeogitOrg/neogit { 'NeogitOrg/neogit', config = function() -- This contains mainly Neogit but also a bunch of Git settings -- like fetching branches with telescope or blaming with fugitive local neogit = require 'neogit' vim.keymap.set('n', 'gs', neogit.open, { silent = true, noremap = true }) vim.keymap.set('n', 'gc', ':Neogit commit', { silent = true, noremap = true }) vim.keymap.set('n', 'gp', ':Neogit pull', { silent = true, noremap = true }) vim.keymap.set('n', 'gP', ':Neogit push', { silent = true, noremap = true }) vim.keymap.set('n', 'gb', ':Telescope git_branches', { silent = true, noremap = true }) vim.keymap.set('n', 'gB', ':G blame', { silent = true, noremap = true }) neogit.setup { disable_commit_confirmation = true, disable_signs = false, disable_context_highlighting = false, disable_builtin_notifications = false, signs = { section = { '', '' }, item = { '', '' }, hunk = { '', '' }, }, integrations = { diffview = true, }, } end, }, }