refactor(nvim): update git nix code
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-12-22 03:20:05 -05:00
parent 157a74df47
commit b34b174c68

View file

@ -1,27 +1,41 @@
{pkgs, ...}: {
programs.neovim.plugins = [
pkgs.vimPlugins.fugitive
{
config,
lib,
pkgs,
...
}: let
inherit (lib) mkIf;
{
plugin = pkgs.vimPlugins.gitsigns-nvim;
type = "lua";
config =
# lua
''
local gitsigns = require("gitsigns");
cfg = config.programs.neovim;
in {
config = mkIf cfg.enable {
programs.neovim.plugins = [
pkgs.vimPlugins.fugitive
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
{
plugin = pkgs.vimPlugins.gitsigns-nvim;
type = "lua";
config =
# lua
''
local gitsigns = require("gitsigns");
vim.keymap.set("v", "gs", function()
visual_stage()
end);
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
gitsigns.setup();
'';
}
];
vim.keymap.set("v", "gs", function()
visual_stage()
end);
gitsigns.setup();
'';
}
];
};
# For accurate stack trace
_file = ./default.nix;
}