nix-community.nixvim/plugins/utils/mini.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

52 lines
1.1 KiB
Nix
Raw Normal View History

2023-06-11 12:25:42 +02:00
{
lib,
helpers,
config,
pkgs,
2023-06-11 12:25:42 +02:00
...
}:
with lib;
let
cfg = config.plugins.mini;
in
{
options.plugins.mini = {
enable = mkEnableOption "mini.nvim";
package = lib.mkPackageOption pkgs "mini.nvim" {
default = [
"vimPlugins"
"mini-nvim"
];
};
2023-06-11 12:25:42 +02:00
modules = mkOption {
type = with types; attrsOf attrs;
default = { };
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";
};
2023-12-08 21:30:08 +00:00
surround = { };
2023-06-11 12:25:42 +02:00
};
};
};
config = mkIf cfg.enable {
extraPlugins = [ cfg.package ];
extraConfigLua = concatLines (
mapAttrsToList (
name: config: "require('mini.${name}').setup(${helpers.toLuaObject config})"
) cfg.modules
);
};
}