nixos-configs/homeManagerModules/neovim/git/default.nix

42 lines
821 B
Nix
Raw Permalink Normal View History

2024-12-22 03:20:05 -05:00
{
config,
lib,
pkgs,
...
}: let
inherit (lib) mkIf;
2024-12-22 03:20:05 -05:00
cfg = config.programs.neovim;
in {
config = mkIf cfg.enable {
programs.neovim.plugins = [
pkgs.vimPlugins.fugitive
2024-12-22 03:20:05 -05:00
{
plugin = pkgs.vimPlugins.gitsigns-nvim;
type = "lua";
config =
# lua
''
local gitsigns = require("gitsigns");
2024-12-22 03:20:05 -05:00
local function visual_stage()
local first_line = vim.fn.line('v');
local last_line = vim.fn.getpos('.')[2];
gitsigns.stage_hunk({ first_line, last_line });
end
2024-12-22 03:20:05 -05:00
vim.keymap.set("v", "gs", function()
visual_stage()
end);
gitsigns.setup();
'';
}
];
};
# For accurate stack trace
_file = ./default.nix;
}