Skip to content

Commit 175b7a4

Browse files
axelkarkhaneliman
authored andcommitted
plugins/lzn-auto-require: init
1 parent e7e6cfd commit 175b7a4

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{ lib, ... }:
2+
lib.nixvim.plugins.mkNeovimPlugin {
3+
name = "lzn-auto-require";
4+
description = ''
5+
Auto load optional plugins via lua modules with `lz.n`.
6+
7+
This plugin overrides the `require` function to also search for plugins in
8+
`{packpath}/*/opt` and load them using `lz.n`.
9+
'';
10+
11+
hasSettings = false;
12+
setup = ".enable";
13+
configLocation = lib.mkOrder 5000 "extraConfigLuaPost"; # Register after everything to catch mistates
14+
15+
maintainers = [ lib.maintainers.axka ];
16+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
e2e =
3+
{ lib, ... }:
4+
{
5+
plugins.lz-n.enable = true;
6+
plugins.lzn-auto-require.enable = true;
7+
8+
plugins.smart-splits = {
9+
enable = true;
10+
lazyLoad.settings.lazy = true; # manual lazy-loading
11+
};
12+
13+
extraConfigLuaPost = lib.mkMerge [
14+
(lib.mkOrder 4999 ''
15+
local success, _ = pcall(require, 'smart-splits')
16+
if success then
17+
print("require should not succeed")
18+
end
19+
'')
20+
(lib.mkOrder 5001 ''
21+
local success, _ = pcall(require, 'smart-splits')
22+
if not success then
23+
print("require should succeed")
24+
end
25+
'')
26+
];
27+
};
28+
}

0 commit comments

Comments
 (0)