-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlze.txt
More file actions
270 lines (224 loc) · 9.23 KB
/
lze.txt
File metadata and controls
270 lines (224 loc) · 9.23 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
lze *lze*
lze.register_handlers *lze.register_handlers*
registers a handler with lze to add new spec fields
Returns the list of spec_field values added.
THIS SHOULD BE CALLED BEFORE ANY CALLS TO lze.load ARE MADE
Type: ~
(fun(handlers:lze.Handler[]|lze.Handler|lze.HandlerSpec[]|lze.HandlerSpec):string[])
lze.clear_handlers *lze.clear_handlers*
Returns the cleared handlers
THIS SHOULD BE CALLED BEFORE ANY CALLS TO lze.load ARE MADE
Type: ~
(fun():lze.Handler[])
lze.remove_handlers *lze.remove_handlers*
Returns the cleared handlers
THIS SHOULD BE CALLED BEFORE ANY CALLS TO lze.load ARE MADE
Type: ~
(fun(handler_names:string|string[]):lze.Handler[])
lze.trigger_load *lze.trigger_load*
Trigger loading of the lze.Plugin loading hooks.
Used by handlers to load plugins.
Will return the names of the plugins that were skipped,
either because they were already loaded or because they
were never added to the queue.
Type: ~
(fun(plugin_names:string[]|string):string[])
lze.load *lze.load*
May be called as many times as desired.
Will return the duplicate lze.Plugin objects.
Priority spec field only affects order for
non-lazy plugins within a single load call.
accepts a list of lze.Spec or a single lze.Spec
may accept a module name to require instead
Type: ~
(fun(spec:string|lze.Spec):lze.Plugin[])
lze.State *lze.State*
`false` for already loaded (or being loaded currently),
`nil` for never added. READ ONLY TABLE
Either a function which takes a name, or a table.
Function access only checks; table access returns a COPY.
unary minus is defined as vim.deepcopy of the actual state table
local snapshot = -require('lze').state
whereas the following will return this object, and thus remain up to date
local state = require('lze').state
Variants: ~
lze.state *lze.state*
| fun(name: string): boolean? # Faster, returns `boolean?`.
| table<string, lze.Plugin|false?> # Access returns COPY of state for that plugin name.
Type: ~
(lze.State)
lze.h *lze.h*
Handlers may expose things by registering them in their lib table
require('lze').h.<spec_field>.<key>
wont populate unless used, will be removed if handler is removed
Type: ~
(table<string,table>)
*lze.types*
>lua
---@meta
error("Cannot import a meta module")
---@class lze.PluginBase
---
---Whether to enable this plugin. Useful to disable plugins under certain conditions.
---@field enabled? boolean|(fun():boolean)
---
---Only useful for lazy=false plugins to force loading certain plugins first.
---Default priority is 50
---@field priority? number
---
---Set this to override the `load` function for an individual plugin.
---Defaults to `vim.g.lze.load()`, see |lze.Config|.
---@field load? fun(name: string)
---
---True will allow a plugin to be added to the queue again after it has already been triggered.
---@field allow_again? boolean
---
---Will be run before loading any plugins in that require('lze').load() call
---@field beforeAll? fun(self:lze.Plugin)
---
---Will be run before loading this plugin
---@field before? fun(self:lze.Plugin)
---
---Will be executed after loading this plugin
---@field after? fun(self:lze.Plugin)
---
---Whether to lazy-load this plugin. Defaults to `false`.
---Using a handler's field sets this automatically.
---@field lazy? boolean
-- NOTE:
-- Builtin Handler Types:
---@class lze.KeysBase: vim.keymap.set.Opts
---@field desc? string
---@field noremap? boolean
---@field remap? boolean
---@field expr? boolean
---@field nowait? boolean
---@field ft? string|string[]
---@class lze.KeysSpec: lze.KeysBase
---@field [1]? string [1] or lhs required, [1] wins
---@field [2]? string|fun()|false will override rhs
---@field lhs? string [1] or lhs required, [1] wins
---@field rhs? string|fun()|false [2] will override rhs if set
---@field mode? string|string[]
---@class lze.Keys: lze.KeysBase
---@field lhs string lhs
---@field rhs? string|fun() rhs
---@field mode? string
---@field id string
---@field name string
---@alias lze.Event {id:string, event:string[]|string, pattern?:string[]|string, augroup:integer}
---@alias lze.EventSpec string|{event?:string|string[], pattern?:string|string[], augroup?:integer}|string[]
---@class lze.SpecHandlers
---
---Load a plugin on one or more |autocmd-events|.
---@field event? string|lze.EventSpec[]
---
---Load a plugin on one or more |user-commands|.
---@field cmd? string[]|string
---
---Load a plugin on one or more |FileType| events.
---@field ft? string[]|string
---
---Load a plugin on one or more |key-mapping|s.
---@field keys? string|string[]|lze.KeysSpec[]
---
---Load a plugin on one or more |colorscheme| events.
---@field colorscheme? string[]|string
---
---Load a plugin before load of one or more other plugins.
---@field dep_of? string[]|string
---
---Load a plugin after load of one or more other plugins.
---@field on_plugin? string[]|string
---
---Accepts a top-level lua module name or a
---list of top-level lua module names.
---Will load when any submodule of those listed is `require`d
---@field on_require? string[]|string
---
---@field [string] any? Fields for any extra handlers you might add
-- NOTE:
-- Defintion of lze.Plugin and lze.PluginSpec
-- combining above types.
---Internal lze.Plugin type, after being parsed.
---Is the type passed to handlers in modify and add hooks.
---@class lze.Plugin: lze.PluginBase,lze.SpecHandlers
---The plugin name (not its main module), e.g. "sweetie.nvim"
---@field name string
---The lze.PluginSpec type, passed to require('lze').load() as entries in lze.Spec
---@class lze.PluginSpec: lze.PluginBase,lze.SpecHandlers
---The plugin name (not its main module), e.g. "sweetie.nvim"
---@field [1] string
---@class lze.SpecImport
---@field import string|lze.Spec|(fun():lze.Spec) spec module to import
---@field enabled? boolean|(fun():boolean)
---List of lze.PluginSpec and/or lze.SpecImport
---@alias lze.Spec lze.PluginSpec | lze.Plugin | lze.SpecImport | lze.Spec[]
-- NOTE:
-- lze.Handler type definition
---Listed in the order they are called by lze if the handler has been registered
---@class lze.Handler
---@field spec_field string
---
---Your handler's 1 chance to modify plugins before they are entered into state!
---Called only if your field was present.
---@field modify? fun(plugin: lze.Plugin): lze.Plugin, fun()?
---
---Called after being entered into state but before any loading has occurred
---@field add? fun(plugin: lze.Plugin): fun()?
---
---Whether using this handler's field should have an effect on the lazy setting
---True or nil is true
---Default: nil
---@field set_lazy? boolean
---
---Handlers may export functions and other values via this set,
---which then may be accessed via `require('lze').h[spec_field].your_func()`
---@field lib? table
---Called when the handler is registered
---@field init? fun()
---Allows you to clean up any global modifications your handler makes to the environment.
---@field cleanup? fun()
---
---runs at the end of require('lze').load()
---for handlers to set up extra triggers such as the
---event handler's DeferredUIEnter event
---@field post_def? fun()
---
---Plugin's before will run first
---@field before? fun(name: string)
---Plugin's load will run here
---@field after? fun(name: string)
---Plugin's after will run after
---Optional, for passing to register_handlers,
---if easily changing if a handler gets added or not is desired
---@class lze.HandlerSpec
---@field handler lze.Handler
---@field enabled? boolean|(fun():boolean)
-- NOTE:
-- global vim.g.lze config values table
---@class lze.Config
---
---Default callback used to load a plugin.
---Takes the plugin name (not the module name). Defaults to |packadd| if not set.
---Not provided to handler hooks
---@field load? fun(name: string)
---
---Allows you to inject a default value
---for any non-nil plugin spec field
---which will be visible to all handler hooks.
---@field injects? table
---
---If false, lze will print error messages on fewer things.
---@field verbose? boolean
---
---Default priority for startup plugins. Defaults to 50 if unset
---@field default_priority? integer
---
---If true, lze will not automatically register the default handlers.
---@field without_default_handlers? boolean
---@type lze.Config
vim.g.lze = vim.g.lze
<
==============================================================================
vim:tw=78:ts=8:noet:ft=help:norl: