lz.n: load lz.n

This commit is contained in:
Ching Pei Yang 2024-07-10 00:28:18 +02:00 committed by Pei Yang Ching
parent 7abd0f8626
commit 6e3292f2c4

View file

@ -3,12 +3,26 @@
config, config,
... ...
}: let }: let
inherit (builtins) toJSON;
inherit (lib.modules) mkIf; inherit (lib.modules) mkIf;
inherit (lib.attrsets) mapAttrsToList;
inherit (lib.generators) mkLuaInline;
inherit (lib.nvim.lua) toLuaObject;
inherit (lib.nvim.dag) entryAnywhere;
cfg = config.vim.lazy; cfg = config.vim.lazy;
toLznSpec = name: plugin:
(removeAttrs plugin ["package"])
// {__HACK = mkLuaInline "nil, [1] = ${toJSON name}";};
lznSpecs = mapAttrsToList toLznSpec cfg.plugins;
in { in {
config.vim = mkIf cfg.enable { config.vim = mkIf cfg.enable {
startPlugins = ["lz-n"]; startPlugins = ["lz-n"];
# optPlugins = optPlugins = mapAttrsToList (_: plugin: plugin.package) cfg.plugins;
luaConfigRC.lzn-load = entryAnywhere ''
require('lz.n').load(${toLuaObject lznSpecs})
'';
}; };
} }