-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathlegendary-api.txt
357 lines (221 loc) · 8.06 KB
/
legendary-api.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
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
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
==============================================================================
*legendary*
M.setup() *legendary.setup*
M.repeat_previous({ignore_filters}) *legendary.repeat_previous*
Repeat execution of the previously selected item. By default, only executes if the previously used filters
still return true.
Parameters: ~
{ignore_filters} (boolean|nil) whether to ignore the filters used when selecting the item, default false
M.find({opts}) *legendary.find*
Find items using vim.ui.select()
Parameters: ~
{opts} (LegendaryFindOpts) @overload fun()
M.keymap({keymap}) *legendary.keymap*
Bind a *single keymap*
Parameters: ~
{keymap} (table)
M.command({command}) *legendary.command*
Bind a *single command*
Parameters: ~
{command} (table)
M.func({function}) *legendary.func*
Bind a *single function*
Parameters: ~
{function} (table)
M.itemgroup({itemgroup}) *legendary.itemgroup*
Bind a *single item group*
Parameters: ~
{itemgroup} (table)
M.autocmds({aus}) *legendary.autocmds*
@diagnostic enable: undefined-doc-param
Bind a *list of* autocmds and/or augroups
Parameters: ~
{aus} (table)
M.autocmd({au}) *legendary.autocmd*
Bind a *single autocmd/augroup*
Parameters: ~
{au} (table)
==============================================================================
*legendary.filters*
M.mode({mode}) *legendary.filters.mode*
Return a `LegendaryItemFilter` that filters items
by the specified mode
Parameters: ~
{mode} (string)
Returns: ~
(LegendaryItemFilter)
M.AND({...}) *legendary.filters.AND*
Logical AND the given LegendaryItemFilters
Parameters: ~
{...} (LegendaryItemFilter)
Returns: ~
(LegendaryItemFilter)
M.OR({...}) *legendary.filters.OR*
Logical OR the given LegendaryItemFilters
Parameters: ~
{...} (LegendaryItemFilter)
Returns: ~
(LegendaryItemFilter)
M.current_mode() *legendary.filters.current_mode*
Return a `LegendaryItemFilter` that filters items
by the current mode
Returns: ~
(LegendaryItemFilter)
M.keymaps() *legendary.filters.keymaps*
Filter to only show keymaps
Returns: ~
(LegendaryItemFilter)
M.commands() *legendary.filters.commands*
Filter to only show commands
Returns: ~
(LegendaryItemFilter)
M.autocmds() *legendary.filters.autocmds*
Filter to only show autocmds
Returns: ~
(LegendaryItemFilter)
M.funcs() *legendary.filters.funcs*
Filter to only show functions
Returns: ~
(LegendaryItemFilter)
==============================================================================
*legendary.toolbox*
M.lazy({fn}, {...}) *legendary.toolbox.lazy*
Return a function with statically set arguments.
Parameters: ~
{fn} (function) The function to execute lazily
{...} (any) The arguments to pass to `fn` when called
Returns: ~
(function)
*legendary.toolbox.lazy_required_fn*
M.lazy_required_fn({module_name}, {fn_name}, {...})
Return a function which lazily `require`s a module and
calls a function from it. Functions nested within tables
may be accessed using dot-notation, i.e.
`lazy_required_fn('module_name', 'some.nested.fn', some_argument)`
Parameters: ~
{module_name} (string) The module to `require`
{fn_name} (string) The table path to the function
{...} (any) The arguments to pass to the function
Returns: ~
(function)
M.split_then({fn}) *legendary.toolbox.split_then*
Return a function that creates a new horizontal
split, then calls the given function.
Parameters: ~
{fn} (function) The function to call after creating a split
Returns: ~
(function)
M.vsplit_then({fn}) *legendary.toolbox.vsplit_then*
Return a function that creates a new vertical
split, then calls the given function.
Parameters: ~
{fn} (function) The function to call after creating a split
Returns: ~
(function)
M.is_keymap({keymap}) *legendary.toolbox.is_keymap*
Check if an item is a Keymap
Parameters: ~
{keymap} (LegendaryItem)
Returns: ~
(boolean)
M.is_command({cmd}) *legendary.toolbox.is_command*
Check if an item is a Command
Parameters: ~
{cmd} (LegendaryItem)
Returns: ~
(boolean)
M.is_augroup({au}) *legendary.toolbox.is_augroup*
Check if an item is an Augroup
Parameters: ~
{au} (LegendaryItem)
Returns: ~
(boolean)
M.is_autocmd({autocmd}) *legendary.toolbox.is_autocmd*
Check if an item is an Autocmd
Parameters: ~
{autocmd} (LegendaryItem)
Returns: ~
(boolean)
M.is_augroup_or_autocmd({au_or_autocmd})*legendary.toolbox.is_augroup_or_autocmd*
Check if an item is an Augroup or Autocmd
Parameters: ~
{au_or_autocmd} (LegendaryItem)
Returns: ~
(boolean)
M.is_itemgroup() *legendary.toolbox.is_itemgroup*
M.is_function({func}) *legendary.toolbox.is_function*
Check if an item is a Function
Parameters: ~
{func} (LegendaryItem)
Returns: ~
(boolean)
M.is_visual_mode({mode_str}) *legendary.toolbox.is_visual_mode*
Check if the given mode string indicates a visual mode or a sub-mode of visual mode.
Defaults to `vim.fn.mode()`
Parameters: ~
{mode_str} (string|nil)
Returns: ~
(boolean) @overload fun()
Marks *legendary.toolbox.Marks*
M.get_marks() *legendary.toolbox.get_marks*
@field [1] integer
@field [2] integer
@field [3] integer
@field [4] integer
Get visual marks in format {start_line, start_col, end_line, end_col}
Returns: ~
(Marks)
M.set_marks({marks}) *legendary.toolbox.set_marks*
Set visual marks from a table in the format
{start_line, start_col, end_line, end_col}
Parameters: ~
{marks} (Marks) the marks to set
*legendary.toolbox.table_from_vimscript*
M.table_from_vimscript({vimscript_str}, {description})
Parse a vimscript mapping command (e.g. `vnoremap <silent> <leader>f :SomeCommand<CR>`)
and return a `legendary.nvim` keymapping table that can be used in your configuration.
Parameters: ~
{vimscript_str} (string)
{description} (string)
Returns: ~
(table)
==============================================================================
*legendary.ui.format*
*legendary.ui.format.LegendaryItemFormatter*
LegendaryItemFormatter
Type: ~
fun(items:LegendaryItem[],mode:string):string[]
M.default_format({item}) *legendary.ui.format.default_format*
Default format
Parameters: ~
{item} (LegendaryItem)
Returns: ~
(string[])
*legendary.ui.format.compute_padding*
M.compute_padding({items}, {mode}, {formatter})
Format items
Parameters: ~
{items} (LegendaryItem[])
{mode} (string)
{formatter} (LegendaryItemFormatter)
*legendary.ui.format.format_item*
M.format_item({item}, {formatter}, {padding}, {mode})
Format a single item, meant to be used in `vim.ui.select()`
Parameters: ~
{item} (LegendaryItem)
{formatter} (LegendaryItemFormatter)
{padding} (integer[])
{mode} (string)
Returns: ~
(string)
M.load_all() *M.load_all*
Load all extensions specified in legendary.nvim config
*M.load_extension*
M.load_extension({extension_name}, {config})
Load a single extension by name. If config is not provided,
it will be looked up in the legendary.nvim config.
Parameters: ~
{extension_name} (string)
{config} (any)
M.pre_ui_hook() *M.pre_ui_hook*
vim:tw=78:ts=8:noet:ft=help:norl: