2023-06-11 12:25:42 +02:00
|
|
|
{
|
|
|
|
lib,
|
2023-11-06 15:04:08 +01:00
|
|
|
helpers,
|
|
|
|
config,
|
|
|
|
pkgs,
|
2023-06-11 12:25:42 +02:00
|
|
|
...
|
|
|
|
}:
|
2024-05-05 19:39:35 +02:00
|
|
|
with lib;
|
|
|
|
let
|
2023-06-11 12:25:42 +02:00
|
|
|
cfg = config.plugins.mini;
|
2024-05-05 19:39:35 +02:00
|
|
|
in
|
|
|
|
{
|
2023-06-11 12:25:42 +02:00
|
|
|
options.plugins.mini = {
|
|
|
|
enable = mkEnableOption "mini.nvim";
|
|
|
|
|
2024-05-17 14:09:20 +02:00
|
|
|
package = helpers.mkPluginPackageOption "mini.nvim" pkgs.vimPlugins.mini-nvim;
|
2023-06-11 12:25:42 +02:00
|
|
|
|
|
|
|
modules = mkOption {
|
|
|
|
type = with types; attrsOf attrs;
|
2024-05-05 19:39:35 +02:00
|
|
|
default = { };
|
2023-06-11 12:25:42 +02:00
|
|
|
description = ''
|
|
|
|
Enable and configure the mini modules.
|
|
|
|
The keys are the names of the modules (without the `mini.` prefix).
|
|
|
|
The value is an attrs of configuration options for the module.
|
|
|
|
Leave the attrs empty to use the module's default configuration.
|
|
|
|
'';
|
|
|
|
example = {
|
|
|
|
ai = {
|
|
|
|
n_lines = 50;
|
|
|
|
search_method = "cover_or_next";
|
|
|
|
};
|
2024-05-05 19:39:35 +02:00
|
|
|
surround = { };
|
2023-06-11 12:25:42 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2024-05-05 19:39:35 +02:00
|
|
|
extraPlugins = [ cfg.package ];
|
2023-06-11 12:25:42 +02:00
|
|
|
|
2024-05-05 19:39:35 +02:00
|
|
|
extraConfigLua = concatLines (
|
|
|
|
mapAttrsToList (
|
|
|
|
name: config: "require('mini.${name}').setup(${helpers.toLuaObject config})"
|
|
|
|
) cfg.modules
|
|
|
|
);
|
2023-06-11 12:25:42 +02:00
|
|
|
};
|
|
|
|
}
|