mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-01-26 11:14:08 +00:00
51 lines
1.2 KiB
Lua
51 lines
1.2 KiB
Lua
return {
|
|
-- Git integration for buffers
|
|
-- https://github.com/lewis6991/gitsigns.nvim
|
|
{
|
|
'lewis6991/gitsigns.nvim',
|
|
lazy = false,
|
|
config = function()
|
|
require('gitsigns').setup {
|
|
signs = {
|
|
add = { text = '+' },
|
|
change = { text = '~' },
|
|
delete = { text = '_' },
|
|
topdelete = { text = '‾' },
|
|
changedelete = { text = '~' },
|
|
},
|
|
current_line_blame = false,
|
|
on_attach = function(bufnr)
|
|
local gs = 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', 'gn', function()
|
|
if vim.wo.diff then
|
|
return ']c'
|
|
end
|
|
vim.schedule(function()
|
|
gs.next_hunk()
|
|
end)
|
|
return '<Ignore>'
|
|
end, { expr = true })
|
|
|
|
map('n', 'gp', function()
|
|
if vim.wo.diff then
|
|
return '[c'
|
|
end
|
|
vim.schedule(function()
|
|
gs.prev_hunk()
|
|
end)
|
|
return '<Ignore>'
|
|
end, { expr = true })
|
|
end,
|
|
}
|
|
end,
|
|
},
|
|
}
|