return { 'lewis6991/gitsigns.nvim', event = 'VeryLazy', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = { add = { text = '▌' }, change = { text = '▌' }, delete = { text = '▌' }, topdelete = { text = '▌' }, changedelete = { text = '▌' }, }, word_diff = false, current_line_blame = true, linehl = true, numhl = true, sign_priority = 6, preview_config = { border = 'rounded', }, on_attach = function(bufnr) local function map(mode, l, r, opts) opts = opts or {} opts.buffer = bufnr vim.keymap.set(mode, l, r, opts) end local gs = package.loaded.gitsigns map('n', 'hs', gs.stage_hunk) map('n', 'hr', gs.reset_hunk) map('v', 'hs', function() gs.stage_hunk { vim.fn.line('.'), vim.fn.line('v') } end) map('v', 'hr', function() gs.reset_hunk { vim.fn.line('.'), vim.fn.line('v') } end) map('n', 'hp', gs.preview_hunk) map('n', 'hd', gs.diffthis) 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 }) end } }