7
7
...
8
8
} :
9
9
with lib ;
10
- let
11
- lzPluginType =
12
- with helpers . nixvimTypes ;
13
- let
14
- maybeRawStrOrList = oneOf [
15
- str
16
- ( listOf ( maybeRaw str ) )
17
- rawLua
18
- ] ;
19
- in
20
- submodule {
21
- freeformType = attrsOf anything ;
22
- options = {
23
- __unkeyed = mkOption {
24
- type = str ;
25
- description = ''
26
- The "unkeyed" attribute is the plugin's name.
27
- This is passed to `load` function and should normally match the repo name of the plugin.
28
-
29
- More specifically, this is the name of the folder in `/pack/opt/{name}` that is loaded with `load` (`packadd` by default).
30
- See `:h packadd`.
31
- '' ;
32
- } ;
33
- enabled = helpers . defaultNullOpts . mkStrLuaFnOr bool true ''
34
- When false, or if the function returns false, then this plugin will not be included in the spec.
35
- This option corresponds to the `enabled` property of lz.n.
36
- '' ;
37
- beforeAll = helpers . mkNullOrLuaFn "Always executed before any plugins are loaded." ;
38
- before = helpers . mkNullOrLuaFn "Executed before this plugin is loaded." ;
39
- after = helpers . mkNullOrLuaFn "Executed after this plugin is loaded." ;
40
- event = helpers . mkNullOrOption maybeRawStrOrList "Lazy-load on event. Events can be specified as BufEnter or with a pattern like BufEnter *.lua" ;
41
- cmd = helpers . mkNullOrOption maybeRawStrOrList "Lazy-load on command." ;
42
- ft = helpers . mkNullOrOption maybeRawStrOrList "Lazy-load on filetype." ;
43
- colorscheme = helpers . mkNullOrOption maybeRawStrOrList "Lazy-load on colorscheme." ;
44
- keys = helpers . mkNullOrOption' {
45
- type = maybeRawStrOrList ;
46
- description = "Lazy-load on key mapping. Mode is `n` by default." ;
47
- example = [
48
- "<C-a>"
49
- ( helpers . mkRaw ''{ "<leader>ft", "<CMD>Neotree toggle<CR>", desc = "NeoTree toggle" }'' )
50
- ] ;
51
- } ;
52
- priority = helpers . defaultNullOpts . mkUnsignedInt ( lib . literalMD "`50` (or `1000` if `colorscheme` is set)" ) ''
53
- Only useful for start plugins (not lazy-loaded) to force loading certain plugins first.
54
- '' ;
55
- load = helpers . mkNullOrLuaFn "Can be used to override the `vim.g.lz_n.load()` function for this plugin." ;
56
- } ;
57
- } ;
58
- in
59
10
helpers . neovim-plugin . mkNeovimPlugin config {
60
11
name = "lz-n" ;
61
12
originalName = "lz.n" ;
@@ -76,50 +27,139 @@ helpers.neovim-plugin.mkNeovimPlugin config {
76
27
77
28
callSetup = false ; # Does not use setup
78
29
79
- extraOptions = {
80
- plugins = mkOption {
81
- description = ''
82
- List of plugin specs provided to the `require('lz.n').load` function.
83
- Plugin specs can be ${ helpers . nixvimTypes . rawLua . description } .
84
- '' ;
85
- default = [ ] ;
86
- type = types . listOf lzPluginType ;
87
- example = [
88
- {
89
- __unkeyed = "neo-tree.nvim" ;
90
- enabled = ''
91
- function()
92
- return true
93
- end
94
- '' ;
95
- keys = helpers . mkRaw ''{ "<leader>ft", "<CMD>Neotree toggle<CR>", desc = "NeoTree toggle" }'' ;
96
- after = ''
97
- function()
98
- require("neo-tree").setup()
99
- end
100
- '' ;
101
- }
102
- {
103
- __unkeyed = "telescope.nvim" ;
104
- cmd = [ "Telescope" ] ;
105
- keys = [
106
- ( helpers . mkRaw ''{ "<leader>fa", "<CMD>Telescope autocommands<CR>", desc = "Telescope autocommands" }'' )
107
- ( helpers . mkRaw ''{ "<leader>fb", "<CMD>Telescope buffers<CR>", desc = "Telescope buffers" }'' )
108
- ] ;
109
- }
110
- {
111
- __unkeyed = "onedarker.nvim" ;
112
- colorscheme = [ "onedarker" ] ;
113
- }
114
- ( helpers . mkRaw ''
30
+ extraOptions =
31
+ let
32
+ lzPluginType =
33
+ with helpers . nixvimTypes ;
34
+ submodule {
35
+ freeformType = attrsOf anything ;
36
+ options = {
37
+ __unkeyed = mkOption {
38
+ type = str ;
39
+ description = ''
40
+ The "unkeyed" attribute is the plugin's name.
41
+ This is passed to `load` function and should normally match the repo name of the plugin.
42
+
43
+ More specifically, this is the name of the folder in `/pack/opt/{name}` that is loaded with `load` (`packadd` by default).
44
+ See `:h packadd`.
45
+ '' ;
46
+ } ;
47
+ enabled = helpers . defaultNullOpts . mkStrLuaFnOr bool true ''
48
+ When false, or if the function returns false, then this plugin will not be included in the spec.
49
+ This option corresponds to the `enabled` property of lz.n.
50
+ '' ;
51
+ beforeAll = helpers . mkNullOrLuaFn "Always executed before any plugins are loaded." ;
52
+ before = helpers . mkNullOrLuaFn "Executed before this plugin is loaded." ;
53
+ after = helpers . mkNullOrLuaFn "Executed after this plugin is loaded." ;
54
+ load = helpers . mkNullOrLuaFn "Can be used to override the `vim.g.lz_n.load()` function for this plugin." ;
55
+
56
+ priority = helpers . defaultNullOpts . mkUnsignedInt ( lib . literalMD "`50` (or `1000` if `colorscheme` is set)" ) ''
57
+ Only useful for start plugins (not lazy-loaded) to force loading certain plugins first.
58
+ '' ;
59
+ event = helpers . mkNullOrOption' {
60
+ type = anything ;
61
+ description = "Lazy-load on event. Events can be specified as BufEnter or with a pattern like BufEnter *.lua" ;
62
+ example = [
63
+ "BufEnter *.lua"
64
+ "DeferredUIEnter"
65
+ ] ;
66
+ } ;
67
+ cmd = helpers . mkNullOrOption' {
68
+ type = anything ;
69
+ description = "Lazy-load on command." ;
70
+ example = [
71
+ "Neotree"
72
+ "Telescope"
73
+ ] ;
74
+ } ;
75
+ ft = helpers . mkNullOrOption' {
76
+ type = anything ;
77
+ description = "Lazy-load on filetype." ;
78
+ example = [ "tex" ] ;
79
+ } ;
80
+ colorscheme = helpers . mkNullOrOption' {
81
+ type = anything ;
82
+ description = "Lazy-load on colorscheme." ;
83
+ example = "onedarker" ;
84
+ } ;
85
+ keys = helpers . mkNullOrOption' {
86
+ type = listOf anything ;
87
+ description = "Lazy-load on key mapping. Mode is `n` by default." ;
88
+ example = [
89
+ "<C-a>"
90
+ [
91
+ "<C-x>"
92
+ "g<C-x>"
93
+ ]
94
+ {
95
+ __unkeyed-1 = "<leader>fb" ;
96
+ __unkeyed-2 = "<CMD>Telescope buffers<CR>" ;
97
+ desc = "Telescope buffers" ;
98
+ }
99
+ ( helpers . mkRaw ''{ "<leader>ft", "<CMD>Neotree toggle<CR>", desc = "NeoTree toggle" }'' )
100
+ ] ;
101
+ } ;
102
+ } ;
103
+ } ;
104
+ in
105
+ {
106
+ plugins = mkOption {
107
+ description = ''
108
+ List of plugin specs provided to the `require('lz.n').load` function.
109
+ Plugin specs can be ${ helpers . nixvimTypes . rawLua . description } .
110
+ '' ;
111
+ default = [ ] ;
112
+ type = types . listOf lzPluginType ;
113
+ example = [
115
114
{
116
- "crates.nvim",
117
- ft = "toml",
118
- },
119
- '' )
120
- ] ;
115
+ __unkeyed = "neo-tree.nvim" ;
116
+ enabled = ''
117
+ function()
118
+ return true
119
+ end
120
+ '' ;
121
+ keys = [
122
+ {
123
+ __unkeyed-1 = "<leader>ft" ;
124
+ __unkeyed-2 = "<CMD>Neotree toggle<CR>" ;
125
+ desc = "NeoTree toggle" ;
126
+ }
127
+ ] ;
128
+ after = ''
129
+ function()
130
+ require("neo-tree").setup()
131
+ end
132
+ '' ;
133
+ }
134
+ {
135
+ __unkeyed = "telescope.nvim" ;
136
+ cmd = [ "Telescope" ] ;
137
+ keys = [
138
+ {
139
+ __unkeyed-1 = "<leader>fa" ;
140
+ __unkeyed-2 = "<CMD>Telescope autocommands<CR>" ;
141
+ desc = "Telescope autocommands" ;
142
+ }
143
+ {
144
+ __unkeyed-1 = "<leader>fb" ;
145
+ __unkeyed-2 = "<CMD>Telescope buffers<CR>" ;
146
+ desc = "Telescope buffers" ;
147
+ }
148
+ ] ;
149
+ }
150
+ {
151
+ __unkeyed = "onedarker.nvim" ;
152
+ colorscheme = [ "onedarker" ] ;
153
+ }
154
+ ( helpers . mkRaw ''
155
+ {
156
+ "crates.nvim",
157
+ ft = "toml",
158
+ },
159
+ '' )
160
+ ] ;
161
+ } ;
121
162
} ;
122
- } ;
123
163
124
164
extraConfig = cfg : {
125
165
globals . lz_n = modules . mkAliasAndWrapDefsWithPriority id options . plugins . lz-n . settings ;
0 commit comments