{ 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 "Neogit" {desc = mappings.open.description;}) (mkKeymap "n" keys.commit "Neogit commit" {desc = mappings.commit.description;}) (mkKeymap "n" keys.pull "Neogit pull" {desc = mappings.pull.description;}) (mkKeymap "n" keys.push "Neogit push" {desc = mappings.push.description;}) ]; }; binds.whichKey.register = pushDownDefault { "g" = "+Git"; }; }; }; }