-- Adds git related signs to the gutter, as well as utilities for managing changes -- NOTE: gitsigns is already included in init.lua but contains only the base -- config. This will add also the recommended keymaps. return { { 'lewis6991/gitsigns.nvim', opts = { on_attach = function(bufnr) local gitsigns = 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 vim.cmd.normal { ']c', bang = true } else gitsigns.nav_hunk 'next' end end, { desc = 'Jump to next git [c]hange' }) map('n', '[c', function() if vim.wo.diff then vim.cmd.normal { '[c', bang = true } else gitsigns.nav_hunk 'prev' end end, { desc = 'Jump to previous git [c]hange' }) -- Actions -- Toggles map('n', 'tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' }) map('n', 'tD', gitsigns.toggle_deleted, { desc = '[T]oggle git show [D]eleted' }) end, }, }, }