mirror of
https://github.com/nix-community/nixvim.git
synced 2025-08-03 01:25:22 +02:00
lib/neovim-plugin: support lz-n lazy config
This commit is contained in:
parent
da30527de1
commit
3cfde1554c
3 changed files with 155 additions and 23 deletions
|
@ -116,9 +116,9 @@
|
|||
|
||||
lazyLoad = lib.nixvim.mkLazyLoadOption {
|
||||
inherit originalName;
|
||||
lazyLoadDefaults = (
|
||||
lib.optionalAttrs (isColorscheme && colorscheme != null) { inherit colorscheme; }
|
||||
);
|
||||
lazyLoadDefaults = lib.optionalAttrs (isColorscheme && colorscheme != null) {
|
||||
inherit colorscheme;
|
||||
};
|
||||
};
|
||||
}
|
||||
// lib.optionalAttrs hasSettings {
|
||||
|
@ -171,6 +171,34 @@
|
|||
# Write the lua configuration `luaConfig.content` to the config file
|
||||
(lib.mkIf (!cfg.lazyLoad.enable) (setLuaConfig cfg.luaConfig.content))
|
||||
])
|
||||
++ (lib.optionals hasConfigAttrs [
|
||||
(lib.mkIf (cfg.lazyLoad.backend == "lz.n") {
|
||||
plugins.lz-n = {
|
||||
# infinite recursion?
|
||||
# enable = true;
|
||||
plugins = [
|
||||
{
|
||||
# TODO: handle this for every plugin properly
|
||||
__unkeyed-1 = originalName;
|
||||
# Use provided after, otherwise fallback to normal lua content
|
||||
after = if cfg.lazyLoad.after != null then cfg.lazyLoad.after else cfg.luaConfig.content;
|
||||
inherit (cfg.lazyLoad)
|
||||
enabled
|
||||
priority
|
||||
before
|
||||
beforeAll
|
||||
event
|
||||
cmd
|
||||
ft
|
||||
keys
|
||||
colorscheme
|
||||
extraSettings
|
||||
;
|
||||
}
|
||||
];
|
||||
};
|
||||
})
|
||||
])
|
||||
)
|
||||
);
|
||||
};
|
||||
|
|
|
@ -360,6 +360,15 @@ rec {
|
|||
lazy-loading for ${originalName}
|
||||
'';
|
||||
|
||||
backend =
|
||||
mkEnumFirstDefault
|
||||
[
|
||||
"lz.n"
|
||||
]
|
||||
''
|
||||
The lazy-loading backend to use.
|
||||
'';
|
||||
|
||||
# Spec loading:
|
||||
enabled = mkStrLuaFnOr types.bool (lazyLoadDefaults.enabledInSpec or null) ''
|
||||
When false, or if the function returns false, then ${originalName} will not be included in the spec.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue