git/neogit: module init

This commit is contained in:
Laszlo Bacsi 2025-07-06 15:26:42 +02:00
commit 94908ffb0a
No known key found for this signature in database
GPG key ID: 7AC6E86EE9E48853
8 changed files with 83 additions and 3 deletions

View file

@ -6,6 +6,7 @@ in {
./vim-fugitive
./git-conflict
./gitlinker-nvim
./neogit
];
options.vim.git = {

View file

@ -69,7 +69,7 @@ in {
};
binds.whichKey.register = pushDownDefault {
"<leader>g" = "+Gitsigns";
"<leader>h" = "+Gitsigns";
};
pluginRC.gitsigns = entryAnywhere ''

View file

@ -0,0 +1,39 @@
{
options,
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.nvim.binds) pushDownDefault mkKeymap;
cfg = config.vim.git.neogit;
keys = cfg.mappings;
inherit (options.vim.git.neogit) mappings;
in {
config = mkIf cfg.enable {
vim = {
startPlugins = ["plenary-nvim"];
lazy.plugins.neogit = {
package = "neogit";
setupModule = "neogit";
inherit (cfg) setupOpts;
cmd = ["Neogit"];
keys = [
(mkKeymap "n" keys.open "<Cmd>Neogit<CR>" {desc = mappings.open.description;})
(mkKeymap "n" keys.commit "<Cmd>Neogit commit<CR>" {desc = mappings.commit.description;})
(mkKeymap "n" keys.pull "<Cmd>Neogit pull<CR>" {desc = mappings.pull.description;})
(mkKeymap "n" keys.push "<Cmd>Neogit push<CR>" {desc = mappings.push.description;})
];
};
binds.whichKey.register = pushDownDefault {
"<leader>g" = "+Git";
};
};
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./config.nix
./neogit.nix
];
}

View file

@ -0,0 +1,17 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption;
inherit (lib.nvim.binds) mkMappingOption;
inherit (lib.nvim.types) mkPluginSetupOption;
in {
options.vim.git.neogit = {
enable = mkEnableOption "An Interactive and powerful Git interface [Neogit]";
setupOpts = mkPluginSetupOption "neogit" {};
mappings = {
open = mkMappingOption "Git Status [Neogit]" "<leader>gs";
commit = mkMappingOption "Git Commit [Neogit]" "<leader>gc";
pull = mkMappingOption "Git pull [Neogit]" "<leader>gp";
push = mkMappingOption "Git push [Neogit]" "<leader>gP";
};
};
}