neovimconfig/lua/plugin/gitsigns.lua
2023-12-24 01:00:01 +01:00

40 lines
1.3 KiB
Lua

return {
{
'lewis6991/gitsigns.nvim',
event = "VeryLazy",
config = function()
require('gitsigns').setup({
preview_config = {
border = 'rounded',
},
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', ']c', function()
if vim.wo.diff then return ']c' end
vim.schedule(function() gs.next_hunk() end)
return '<Ignore>'
end, { expr = true })
map('n', '[c', function()
if vim.wo.diff then return '[c' end
vim.schedule(function() gs.prev_hunk() end)
return '<Ignore>'
end, { expr = true })
-- Actions
map('n', '<leader>gB', function() gs.blame_line { full = true } end)
map('n', '<leader>gb', gs.toggle_current_line_blame)
end
})
end,
}
}