require('gitsigns').setup({ signs = { add = { text = '+' }, change = { text = '~' }, delete = { text = '_' }, topdelete = { text = '‾' }, changedelete = { text = '~' }, untracked = { text = '┆' }, }, -- Enable highlighting for the sign column and line numbers signcolumn = true, numhl = true, linehl = false, word_diff = false, on_attach = function(bufnr) local gs = package.loaded.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', ']h', function() if vim.wo.diff then return ']h' end vim.schedule(function() gs.next_hunk() end) return '' end, {expr=true}) map('n', '[h', function() if vim.wo.diff then return '[h' end vim.schedule(function() gs.prev_hunk() end) return '' end, {expr=true}) -- Actions map('n', 'hs', gs.stage_hunk) map('n', 'hr', gs.reset_hunk) map('n', 'hp', gs.preview_hunk) map('n', 'hb', function() gs.blame_line{full=true} end) end })