File tree Expand file tree Collapse file tree 2 files changed +59
-1
lines changed
tests/test-sources/plugins Expand file tree Collapse file tree 2 files changed +59
-1
lines changed Original file line number Diff line number Diff line change 113
113
'' ;
114
114
internal = true ;
115
115
} ;
116
+
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
+ } ;
139
+ } ;
116
140
}
117
141
// lib . optionalAttrs hasSettings {
118
142
settings = lib . nixvim . mkSettingsOption {
162
186
( lib . optionalAttrs callSetup { ${ namespace } . ${ name } . luaConfig . content = setupCode ; } )
163
187
164
188
# Write the lua configuration `luaConfig.content` to the config file
165
- ( setLuaConfig cfg . luaConfig . content )
189
+ ( lib . mkIf ( ! cfg . lazyLoad . enable ) ( setLuaConfig cfg . luaConfig . content ) )
166
190
] )
167
191
)
168
192
) ;
Original file line number Diff line number Diff line change
1
+ {
2
+ lazy-load-plugin =
3
+ { config , ... } :
4
+ {
5
+ plugins = {
6
+ lz-n = {
7
+ enable = true ;
8
+ plugins = [
9
+ {
10
+ __unkeyed-1 = "neotest" ;
11
+ after . __raw = ''
12
+ function()
13
+ ${ config . plugins . neotest . luaConfig . content }
14
+ end
15
+ '' ;
16
+ keys = [
17
+ {
18
+ __unkeyed-1 = "<leader>nt" ;
19
+ __unkeyed-3 = "<CMD>Neotest summary<CR>" ;
20
+ desc = "Summary toggle" ;
21
+ }
22
+ ] ;
23
+
24
+ }
25
+ ] ;
26
+ } ;
27
+
28
+ neotest = {
29
+ enable = true ;
30
+ lazyLoad . enable = true ;
31
+ } ;
32
+ } ;
33
+ } ;
34
+ }
You can’t perform that action at this time.
0 commit comments