Skip to content

Commit da30527

Browse files
committed
lib/neovim-plugin: use mkLazyLoadOption
1 parent 6ed719d commit da30527

File tree

2 files changed

+9
-28
lines changed

2 files changed

+9
-28
lines changed

lib/neovim-plugin.nix

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -114,28 +114,11 @@
114114
internal = true;
115115
};
116116

117-
lazyLoad = lib.mkOption {
118-
default = {
119-
enable = false;
120-
};
121-
description = ''
122-
Lazy load configuration settings.
123-
'';
124-
type = lib.types.submodule {
125-
options = {
126-
enable = lib.mkOption {
127-
default = false;
128-
type = lib.types.bool;
129-
description = ''
130-
Whether to lazy load the plugin.
131-
132-
If you enable this, the plugin's lua configuration will need to be manually loaded by other means.
133-
134-
A usage would be passing the plugin's luaConfig to the `plugins.lz-n.plugins` configuration.
135-
'';
136-
};
137-
};
138-
};
117+
lazyLoad = lib.nixvim.mkLazyLoadOption {
118+
inherit originalName;
119+
lazyLoadDefaults = (
120+
lib.optionalAttrs (isColorscheme && colorscheme != null) { inherit colorscheme; }
121+
);
139122
};
140123
}
141124
// lib.optionalAttrs hasSettings {

lib/options.nix

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -412,13 +412,11 @@ rec {
412412
Equivalence: lz.n => ft; lazy.nvim => ft
413413
'';
414414

415-
keys =
416-
mkNullable (types.listOf lib.nixvim.keymaps.mapOptionSubmodule) (lazyLoadDefaults.keys or null)
417-
''
418-
Lazy-load on key mapping. Use the same format as `config.keymaps`.
415+
keys = mkListOf (types.attrsOf types.anything) (lazyLoadDefaults.keys or null) ''
416+
Lazy-load on key mapping.
419417
420-
Equivalence: lz.n => keys; lazy.nvim => keys
421-
'';
418+
Equivalence: lz.n => keys; lazy.nvim => keys
419+
'';
422420

423421
colorscheme = mkNullable triggerType (lazyLoadDefaults.colorscheme or null) ''
424422
Lazy-load on colorscheme.

0 commit comments

Comments
 (0)