mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-01-09 20:27:16 +00:00
utility/ccc: no hidden mapping, better types
- Remove hidden mapping input/output options into luaInline with prefixes. - Update types of setupOpts sub-options to avoid large blocks of inline Lua in the configuration.
This commit is contained in:
parent
62e53811fc
commit
53e2051610
2 changed files with 83 additions and 91 deletions
|
|
@ -6,22 +6,14 @@
|
|||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
cfg = config.vim.utility.ccc;
|
||||
mkLuaIdentifier = prefix: identifier: mkLuaInline "${prefix}${identifier}";
|
||||
mapSetupOptions = setupOpts:
|
||||
setupOpts
|
||||
// {
|
||||
inputs = map (mkLuaIdentifier "ccc.input.") setupOpts.inputs;
|
||||
outputs = map (mkLuaIdentifier "ccc.output.") setupOpts.outputs;
|
||||
};
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = ["ccc-nvim"];
|
||||
|
||||
vim.pluginRC.ccc = entryAnywhere ''
|
||||
local ccc = require("ccc")
|
||||
ccc.setup(${toLuaObject (mapSetupOptions cfg.setupOpts)})
|
||||
ccc.setup(${toLuaObject cfg.setupOpts})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue