plugins: use mk{Neovim,Vim}Plugin's dependencies parameter

This commit is contained in:
Gaetan Lepage 2025-04-27 09:53:12 +02:00
parent b66559d8ef
commit 1a64636839
49 changed files with 147 additions and 207 deletions

View file

@ -1,5 +1,6 @@
{
lib,
config,
helpers,
...
}:
@ -26,6 +27,25 @@ lib.nixvim.plugins.mkNeovimPlugin {
'')
];
dependencies =
let
defaults = config.plugins.spectre.settings.default;
in
[
{
name = "ripgrep";
enable = defaults.find.cmd == "rg";
}
{
name = "sed";
enable = defaults.replace.cmd == "sed";
}
{
name = "sd";
enable = defaults.replace.cmd == "sd";
}
];
settingsOptions =
let
mkEngineOption =
@ -230,16 +250,4 @@ lib.nixvim.plugins.mkNeovimPlugin {
};
};
};
extraConfig = cfg: {
dependencies =
let
defaults = cfg.settings.default;
in
{
ripgrep.enable = lib.mkIf (defaults.find.cmd == "rg") (lib.mkDefault true);
sed.enable = lib.mkIf (defaults.replace.cmd == "sed") (lib.mkDefault true);
sd.enable = lib.mkIf (defaults.replace.cmd == "sd") (lib.mkDefault true);
};
};
}