mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-20 16:15:43 +02:00
lib/mk-neovim-plugin: allow lazy-loading without luaConfig
This commit is contained in:
parent
f878289722
commit
1671f8618f
1 changed files with 11 additions and 10 deletions
|
@ -113,15 +113,6 @@ let
|
|||
inherit extraConfig cfg opts;
|
||||
}
|
||||
))
|
||||
]
|
||||
# Lua configuration code generation
|
||||
++ lib.optionals hasLuaConfig [
|
||||
|
||||
# Add the plugin setup code `require('foo').setup(...)` to the lua configuration
|
||||
(lib.optionalAttrs callSetup (lib.setAttrByPath loc { luaConfig.content = setupCode; }))
|
||||
|
||||
# When NOT lazy loading, write `luaConfig.content` to `configLocation`
|
||||
(lib.mkIf (!cfg.lazyLoad.enable) luaConfigAtLocation)
|
||||
|
||||
# When lazy loading is enabled for this plugin, route its configuration to the enabled provider
|
||||
(lib.mkIf cfg.lazyLoad.enable {
|
||||
|
@ -131,6 +122,7 @@ let
|
|||
message = "You have enabled lazy loading for ${packPathName} but have not provided any configuration.";
|
||||
}
|
||||
];
|
||||
|
||||
plugins.lz-n = {
|
||||
plugins = [
|
||||
(
|
||||
|
@ -140,7 +132,7 @@ let
|
|||
after =
|
||||
let
|
||||
after = cfg.lazyLoad.settings.after or null;
|
||||
default = "function()\n " + cfg.luaConfig.content + " \nend";
|
||||
default = if hasLuaConfig then "function()\n " + cfg.luaConfig.content + " \nend" else null;
|
||||
in
|
||||
if (lib.isString after || lib.types.rawLua.check after) then after else default;
|
||||
colorscheme = lib.mkIf isColorscheme (cfg.lazyLoad.settings.colorscheme or colorscheme);
|
||||
|
@ -154,6 +146,15 @@ let
|
|||
};
|
||||
})
|
||||
]
|
||||
# Lua configuration code generation
|
||||
++ lib.optionals hasLuaConfig [
|
||||
|
||||
# Add the plugin setup code `require('foo').setup(...)` to the lua configuration
|
||||
(lib.optionalAttrs callSetup (lib.setAttrByPath loc { luaConfig.content = setupCode; }))
|
||||
|
||||
# When NOT lazy loading, write `luaConfig.content` to `configLocation`
|
||||
(lib.mkIf (!cfg.lazyLoad.enable) luaConfigAtLocation)
|
||||
]
|
||||
)
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue