diff --git a/flake.lock b/flake.lock index da38b967..448bd8b2 100644 --- a/flake.lock +++ b/flake.lock @@ -936,6 +936,22 @@ "type": "github" } }, + "plugin-mini-nvim": { + "flake": false, + "locked": { + "lastModified": 1736875588, + "narHash": "sha256-v5cMB/IK+muogipWPtU7rFTfYWO7wr+VyGfqPU/fE70=", + "owner": "echasnovski", + "repo": "mini.nvim", + "rev": "9e603a31d3fbc7ee61c9b556cd84e97fa2dcff53", + "type": "github" + }, + "original": { + "owner": "echasnovski", + "repo": "mini.nvim", + "type": "github" + } + }, "plugin-minimap-vim": { "flake": false, "locked": { @@ -2132,6 +2148,7 @@ "plugin-lz-n": "plugin-lz-n", "plugin-lzn-auto-require": "plugin-lzn-auto-require", "plugin-mind-nvim": "plugin-mind-nvim", + "plugin-mini-nvim": "plugin-mini-nvim", "plugin-minimap-vim": "plugin-minimap-vim", "plugin-modes-nvim": "plugin-modes-nvim", "plugin-neo-tree-nvim": "plugin-neo-tree-nvim", diff --git a/flake.nix b/flake.nix index 89690cad..4d6873ea 100644 --- a/flake.nix +++ b/flake.nix @@ -744,5 +744,11 @@ url = "github:stevearc/aerial.nvim"; flake = false; }; + + # Plugin collections + plugin-mini-nvim = { + url = "github:echasnovski/mini.nvim"; + flake = false; + }; }; } diff --git a/modules/modules.nix b/modules/modules.nix index 6e05c592..19860884 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -19,6 +19,7 @@ plugins = map (p: ./plugins + "/${p}") [ "assistant" "autopairs" + "collections" "comments" "completion" "dashboard" diff --git a/modules/plugins/collections/default.nix b/modules/plugins/collections/default.nix new file mode 100644 index 00000000..7f5524a6 --- /dev/null +++ b/modules/plugins/collections/default.nix @@ -0,0 +1,5 @@ +{ + imports = [ + ./mini-nvim + ]; +} diff --git a/modules/plugins/collections/mini-nvim/config.nix b/modules/plugins/collections/mini-nvim/config.nix new file mode 100644 index 00000000..c04c8191 --- /dev/null +++ b/modules/plugins/collections/mini-nvim/config.nix @@ -0,0 +1,32 @@ +{ + options, + config, + lib, + pkgs, + inputs, + ... +}: let + inherit (lib) mkMerge; + inherit (lib.modules) mkIf; + inherit (lib.strings) concatStringsSep; + inherit (lib.attrsets) mapAttrsToList; + inherit (lib.nvim.lua) toLuaObject; + + cfg = config.vim.collections.mini-nvim; +in { + config = mkIf cfg.enable { + vim.lazy.plugins."mini-nvim" = { + package = "mini-nvim"; + # package = pkgs.vimPlugins.mini-nvim; + # package = pkgs.vimUtils.buildVimPlugin { + # name = "mini-nvim"; + # src = inputs.plugin-mini-nvim; + # }; + lazy = false; + after = concatStringsSep "\n" (mapAttrsToList (name: value: '' + require("mini.${name}").setup(${toLuaObject value.setupOpts}) + '') + cfg.modules); + }; + }; +} diff --git a/modules/plugins/collections/mini-nvim/default.nix b/modules/plugins/collections/mini-nvim/default.nix new file mode 100644 index 00000000..91faca27 --- /dev/null +++ b/modules/plugins/collections/mini-nvim/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./config.nix + ./mini-nvim.nix + ]; +} diff --git a/modules/plugins/collections/mini-nvim/mini-nvim.nix b/modules/plugins/collections/mini-nvim/mini-nvim.nix new file mode 100644 index 00000000..b9764eed --- /dev/null +++ b/modules/plugins/collections/mini-nvim/mini-nvim.nix @@ -0,0 +1,28 @@ +{lib, ...}: let + inherit (lib.options) mkEnableOption mkOption literalExpression; + inherit (lib.types) attrsOf submodule; + inherit (lib.nvim.types) mkPluginSetupOption; +in { + options.vim.collections.mini-nvim = { + enable = mkEnableOption "mini.nvim, a collection of quality-of-life modules"; + modules = mkOption { + type = attrsOf (submodule { + options = { + setupOpts = mkPluginSetupOption "mini.nvim plugin" {}; + }; + }); + default = {}; + example = + literalExpression + '' + { + files = {}; + sessions = { + autoread = true; + autowrite = true; + }; + } + ''; + }; + }; +}