mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
lib/neovim-plugin: support not having settings
Allow callers to explicitly set `settingsOptions = null` to disable creating the `settings` option. `settingsOptions` still defaults to `{ }`.
This commit is contained in:
parent
aff12581d8
commit
c351c175ec
1 changed files with 15 additions and 12 deletions
|
@ -50,6 +50,7 @@ rec {
|
|||
defaultPackage,
|
||||
settingsOptions ? { },
|
||||
settingsExample ? null,
|
||||
hasSettings ? true,
|
||||
extraOptions ? { },
|
||||
# config
|
||||
luaName ? name,
|
||||
|
@ -95,17 +96,19 @@ rec {
|
|||
mkRenamedOptionModule (basePluginPath ++ optionPath) (settingsPath ++ optionPathSnakeCase)
|
||||
) optionsRenamedToSettings);
|
||||
|
||||
options.${namespace}.${name} = {
|
||||
options.${namespace}.${name} =
|
||||
{
|
||||
enable = mkEnableOption originalName;
|
||||
|
||||
package = nixvimOptions.mkPluginPackageOption originalName defaultPackage;
|
||||
|
||||
}
|
||||
// optionalAttrs hasSettings {
|
||||
settings = mkSettingsOption {
|
||||
pluginName = name;
|
||||
options = settingsOptions;
|
||||
example = settingsExample;
|
||||
};
|
||||
} // extraOptions;
|
||||
}
|
||||
// extraOptions;
|
||||
|
||||
config =
|
||||
let
|
||||
|
@ -118,7 +121,7 @@ rec {
|
|||
inherit extraPackages;
|
||||
|
||||
${extraConfigNamespace} = optionalString callSetup ''
|
||||
require('${luaName}').setup(${toLuaObject cfg.settings})
|
||||
require('${luaName}').setup(${optionalString (cfg ? settings) (toLuaObject cfg.settings)})
|
||||
'';
|
||||
}
|
||||
(optionalAttrs (isColorscheme && (colorscheme != null)) { colorscheme = mkDefault colorscheme; })
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue