-
-
Notifications
You must be signed in to change notification settings - Fork 307
/
Copy pathlazyload.nix
60 lines (57 loc) · 1.49 KB
/
lazyload.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
{
config,
lib,
...
}:
let
implementations = [
"lz-n"
"lazy"
];
in
{
config = {
assertions =
let
enabled = builtins.filter (x: config.plugins.${x}.enable) implementations;
count = builtins.length enabled;
in
[
{
assertion = count < 2;
message = ''
You have multiple lazy-loaders enabled:
${lib.concatImapStringsSep "\n" (i: x: "${toString i}. plugins.${x}") enabled}
Please ensure only one is enabled at a time.
'';
}
];
warnings =
let
ignoredPackages = [
# removed
"treesitter-playground"
# renamed
"surround"
"null-ls"
"wilder-nvim"
];
pluginsWithLazyLoad = builtins.filter (
x:
!(lib.elem x ignoredPackages)
&& lib.hasAttr "lazyLoad" config.plugins.${x}
&& config.plugins.${x}.lazyLoad.enable
) (builtins.attrNames config.plugins);
count = builtins.length pluginsWithLazyLoad;
in
lib.nixvim.mkWarnings "lazy loading" {
when = count > 0 && !config.plugins.lz-n.enable;
message = ''
You have enabled lazy loading support for the following plugins but have not enabled a lazy loading provider.
${lib.concatImapStringsSep "\n" (i: x: "${toString i}. plugins.${x}") pluginsWithLazyLoad}
Currently supported lazy providers:
- lz-n
'';
};
};
}