70 lines
1.3 KiB
Nix
70 lines
1.3 KiB
Nix
|
{ 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')
|
||
|
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";
|
||
|
};
|
||
|
}
|
||
|
];
|
||
|
}
|