2024-08-20 05:43:03 +00:00
|
|
|
{ helpers, ... }:
|
|
|
|
|
|
|
|
{
|
|
|
|
plugins.gitsigns = {
|
|
|
|
enable = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
keymaps = [
|
|
|
|
# Navigate through hunks
|
|
|
|
{
|
|
|
|
mode = [ "n" ];
|
|
|
|
key = "]c";
|
|
|
|
action = helpers.mkRaw ''
|
|
|
|
function()
|
|
|
|
if vim.wo.diff then
|
|
|
|
vim.cmd.normal({']c', bang = true})
|
|
|
|
else
|
|
|
|
require("gitsigns").nav_hunk('next')
|
2024-08-20 12:42:19 +00:00
|
|
|
require("gitsigns").preview_hunk
|
2024-08-20 05:43:03 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
'';
|
|
|
|
}
|
|
|
|
{
|
|
|
|
mode = [ "n" ];
|
|
|
|
key = "[c";
|
|
|
|
action = helpers.mkRaw ''
|
|
|
|
function()
|
|
|
|
if vim.wo.diff then
|
|
|
|
vim.cmd.normal({'[c', bang = true})
|
|
|
|
else
|
|
|
|
require("gitsigns").nav_hunk('prev')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
'';
|
|
|
|
}
|
|
|
|
{
|
|
|
|
mode = [ "v" ];
|
|
|
|
key = "<leader>hs";
|
|
|
|
action = helpers.mkRaw ''
|
|
|
|
function()
|
|
|
|
require("gitsigns").stage_hunk({ vim.fn.line("."), vim.fn.line("v") })
|
|
|
|
end
|
|
|
|
'';
|
|
|
|
options = {
|
|
|
|
desc = "Stage Hunk";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
{
|
|
|
|
mode = [ "n" ];
|
|
|
|
key = "<leader>hu";
|
|
|
|
action = helpers.mkRaw ''
|
|
|
|
require("gitsigns").undo_stage_hunk
|
|
|
|
'';
|
|
|
|
options = {
|
|
|
|
desc = "Undo Stage Hunk";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
{
|
|
|
|
mode = [ "n" ];
|
|
|
|
key = "<leader>hp";
|
|
|
|
action = helpers.mkRaw ''
|
|
|
|
require("gitsigns").preview_hunk
|
|
|
|
'';
|
|
|
|
options = {
|
|
|
|
desc = "Preview Hunk";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
];
|
|
|
|
}
|