refactor(nvim): rework whole configuration

This commit is contained in:
Yorick Barbanneau 2025-09-11 00:53:20 +02:00
parent 64c6149fde
commit 710e8f6395
Signed by: ephase
GPG key ID: 246042E52B41FFCF
6 changed files with 90 additions and 45 deletions

View file

@ -0,0 +1,29 @@
require('gitsigns').setup {
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', '<leader>gn', function()
if vim.wo.diff then return ']c' end
vim.schedule(function() gs.next_hunk() end)
return '<Ignore>'
end, {expr=true})
map('n', '<leader>gN', function()
if vim.wo.diff then return '[c' end
vim.schedule(function() gs.prev_hunk() end)
return '<Ignore>'
end, {expr=true})
map('n', '<leader>gs', gs.stage_hunk)
map('n', '<leader>gr', gs.reset_hunk)
map('n', '<leader>gd', gs.diffthis)
map('n', '<leader>gd', function() gs.diffthis('~') end)
end
}