return { 'lewis6991/gitsigns.nvim', event = 'BufReadPre', ---@module 'gitsigns' ---@type GitSigns.Config opts = { signs = { add = { text = '┃' }, change = { text = '┃' }, delete = { text = '▁' }, topdelete = { text = '▔' }, changedelete = { text = '~' }, untracked = { text = '┆' }, }, signs_staged = { add = { text = '┃' }, change = { text = '┃' }, delete = { text = '▁' }, topdelete = { text = '▔' }, changedelete = { text = '~' }, }, signs_staged_enable = true, current_line_blame = false, on_attach = function(bufnr) local gs = require('gitsigns') local function map(mode, lhs, rhs, desc) vim.keymap.set(mode, lhs, rhs, { buffer = bufnr, desc = desc }) end map('n', ']h', function() if vim.wo.diff then vim.cmd.normal({ ']c', bang = true }) else gs.nav_hunk('next') end end, 'Next hunk') map('n', '[h', function() if vim.wo.diff then vim.cmd.normal({ '[c', bang = true }) else gs.nav_hunk('prev') end end, 'Prev hunk') map('n', 'hs', function() gs.stage_hunk({ vim.fn.line('.'), vim.fn.line('v') }) end, 'Stage hunk (selection)') map('v', 'hr', function() gs.reset_hunk({ vim.fn.line('.'), vim.fn.line('v') }) end, 'Reset hunk (selection)') map('n', 'hp', gs.preview_hunk, 'Preview hunk') map('n', 'hd', gs.diffthis, 'Diff this') map('n', 'hD', function() gs.diffthis('~') end, 'Diff this (last commit)') map('n', 'gb', gs.toggle_current_line_blame, 'Toggle line blame') map('n', 'gB', gs.blame, 'Blame buffer') end }, }