-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlze.txt
230 lines (188 loc) · 7.6 KB
/
lze.txt
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
==============================================================================
*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.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.
@overload fun(spec: lze.Spec):string[]
@overload fun(import: string):string[]
lze.State *lze.State*
`false` for already loaded (or being loaded currently),
`nil` for never added. READ ONLY 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.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
---@class lze.PluginHooks
---
---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 lhs
---@field [2]? string|fun()|false rhs
---@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}
---@alias lze.EventSpec string|{event?:string|string[], pattern?:string|string[]}|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
---@class lze.ExtraSpecHandlers
---
---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
-- 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.PluginHooks,lze.SpecHandlers, lze.ExtraSpecHandlers
---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.PluginHooks,lze.SpecHandlers, lze.ExtraSpecHandlers
---The plugin name (not its main module), e.g. "sweetie.nvim"
---@field [1] string
---@class lze.SpecImport
---@field import string spec module to import
---@field enabled? boolean|(fun():boolean)
---List of lze.PluginSpec and/or lze.SpecImport
---@alias lze.Spec lze.PluginSpec | 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
---
---Called after being entered into state but before any loading has occurred
---@field add? fun(plugin: lze.Plugin)
---
---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
---
---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
---
---Callback to load a plugin.
---Takes the plugin name (not the module name). Defaults to |packadd| if not set.
---@field load? fun(name: string)
---
---If false, lze will print error messages on fewer things.
---@field verbose? boolean
---@type lze.Config
vim.g.lze = vim.g.lze
<
vim:tw=78:ts=8:noet:ft=help:norl: