34 lines
776 B
Lua
34 lines
776 B
Lua
local ok, gs = pcall(require, "gitsigns")
|
|
if not ok then
|
|
return
|
|
end
|
|
|
|
gs.setup {
|
|
current_line_blame = true,
|
|
current_line_blame_opts = {
|
|
delay = 300,
|
|
},
|
|
on_attach = function(bufnr)
|
|
local nmap = require("my.utils").nmap
|
|
|
|
nmap("]c", function()
|
|
if vim.wo.diff then
|
|
return "]c"
|
|
end
|
|
vim.schedule(function()
|
|
gs.next_hunk()
|
|
end)
|
|
return "<Ignore>"
|
|
end, "next hunk", bufnr)
|
|
|
|
nmap("[c", function()
|
|
if vim.wo.diff then
|
|
return "[c"
|
|
end
|
|
vim.schedule(function()
|
|
gs.prev_hunk()
|
|
end)
|
|
return "<Ignore>"
|
|
end, "previous hunk", bufnr)
|
|
end,
|
|
}
|