-
-
Notifications
You must be signed in to change notification settings - Fork 18
/
legendary-function-tables.txt
84 lines (66 loc) · 2.84 KB
/
legendary-function-tables.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
*legendary-function-tables.txt* Last change: 2023 July 06
==============================================================================
Table of Contents *legendary-function-tables-table-of-contents*
Basic functions .................. |legendary-function-tables-basic-functions|
Options .................................. |legendary-function-tables-options|
Item Groups .......................... |legendary-function-tables-item-groups|
==============================================================================
FUNCTIONS *legendary-function-tables-functions*
------------------------------------------------------------------------------
BASIC FUNCTIONS *legendary-function-tables-basic-functions*
Functions follow a similar structure as anonymous commands <./COMMANDS.md>,
but description is **required**.
>lua
local functions = {
{
function()
vim.lsp.buf.code_action({
filter = function(a)
return a.isPreferred
end,
apply = true,
})
end,
description = 'Auto Fix...',
},
{
function()
if require('legendary.toolbox').is_visual_mode() then
local cline, _, vline, _ = unpack(require('legendary.toolbox').get_marks())
require('gitsigns').reset_hunk({ cline, vline })
else
require('gitsigns').reset_hunk()
end
end,
description = 'Revert Selected Ranges/Reset the lines of the hunk',
},
{ lazy(vim.cmd.Telescope, 'git_files'), description = 'Git Files' },
}
<
------------------------------------------------------------------------------
OPTIONS *legendary-function-tables-options*
You can also pass options via the `opts` property:
- `buffer` option (a buffer handle, or `0` for current buffer), which will
make the function visible only in the specified buffer.
------------------------------------------------------------------------------
ITEM GROUPS *legendary-function-tables-item-groups*
You can also organize keymaps, commands, and functions into groups that will
show up in the finder UI like a folder, selecting it will then trigger another
finder for items within the group. If groups are given the same name, they
will be merged.
>lua
local functions = {
{
-- name, indicates that this table is an item group
itemgroup = 'short ID',
-- you can also customize the icon for item groups
icon = '',
-- you can also customize the description (first text column)
description = 'A group of items, this can be a little longer...',
funcs = {
-- regular legendary.nvim functions here
},
},
}
<
vim:tw=78:ts=8:ft=help:norl: