Skip to content

Commit 56e61c2

Browse files
committed
docs(#3088): extract api/commands.lua
1 parent 0ad171b commit 56e61c2

5 files changed

Lines changed: 78 additions & 42 deletions

File tree

doc/nvim-tree-lua.txt

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -965,18 +965,6 @@ marks.navigate.select() *nvim-tree-api.marks.navigate.select()*
965965
A folder will be focused, a file will be opened.
966966

967967

968-
==============================================================================
969-
API: Commands *nvim-tree-api.commands*
970-
971-
commands.get() *nvim-tree-api.commands.get()*
972-
Retrieve all commands, see |nvim-tree-commands|
973-
974-
Return: ~
975-
(table) array containing |nvim_create_user_command()| parameters:
976-
{name} (string)
977-
{command} (function)
978-
{opts} (table)
979-
980968
==============================================================================
981969
Mappings *nvim-tree-mappings*
982970

@@ -2732,6 +2720,25 @@ Class: Config.Log *nvim-tree-config-log*
27322720

27332721

27342722

2723+
==============================================================================
2724+
Lua module: nvim_tree.api.commands *nvim-tree-api-commands*
2725+
2726+
*nvim_tree.api.commands.Command*
2727+
Arguments for |nvim_create_user_command()|
2728+
2729+
Fields: ~
2730+
{name} (`string`)
2731+
{command} (`fun(args: vim.api.keyset.create_user_command.command_args)`)
2732+
{opts} (`vim.api.keyset.user_command`)
2733+
2734+
2735+
get() *nvim_tree.api.commands.get()*
2736+
Retrieve all nvim-tree commands, see |nvim-tree-commands|
2737+
2738+
Return: ~
2739+
(`nvim_tree.api.commands.Command[]`)
2740+
2741+
27352742
==============================================================================
27362743
Lua module: nvim_tree.api.events *nvim-tree-api-events*
27372744

lua/nvim-tree/api.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,10 +428,15 @@ Api.diagnostics = {
428428

429429
end
430430

431+
function Api.hydrate_commands(commands)
432+
Api.commands = commands
433+
431434
Api.commands.get = wrap(function()
432435
return require("nvim-tree.commands").get()
433436
end)
434437

438+
end
439+
435440
---Create a decorator class by calling :extend()
436441
---See :help nvim-tree-decorators
437442
---@type nvim_tree.api.decorator.UserDecorator

lua/nvim-tree/api/commands.lua

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---@meta
2+
local nvim_tree = { api = { commands = {} } }
3+
4+
---
5+
---Arguments for [nvim_create_user_command()]
6+
---
7+
---@class nvim_tree.api.commands.Command
8+
---
9+
---@field name string
10+
---@field command fun(args: vim.api.keyset.create_user_command.command_args)
11+
---@field opts vim.api.keyset.user_command
12+
13+
---
14+
---Retrieve all nvim-tree commands, see [nvim-tree-commands]
15+
---
16+
---@return nvim_tree.api.commands.Command[]
17+
function nvim_tree.api.commands.get() end
18+
19+
require("nvim-tree.api").hydrate_commands(nvim_tree.api.commands)
20+
21+
return nvim_tree.api.commands

lua/nvim-tree/commands.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
local M = {}
22

3+
---@type nvim_tree.api.commands.Command[]
34
local CMDS = {
45
{
56
name = "NvimTreeOpen",
@@ -142,6 +143,7 @@ local CMDS = {
142143
},
143144
}
144145

146+
---@return nvim_tree.api.commands.Command[]
145147
function M.get()
146148
return vim.deepcopy(CMDS)
147149
end

scripts/gen_vimdoc_config.lua

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,36 +8,37 @@
88
---Generated within help files in this order
99
---@type Module[]
1010
local modules = {
11-
{ helptag = "nvim-tree-config", title = "Class: Config", path = "./lua/nvim_tree/_meta/config.lua", },
12-
{ helptag = "nvim-tree-config-sort", title = "Class: Config.Sort", path = "./lua/nvim_tree/_meta/config/sort.lua", },
13-
{ helptag = "nvim-tree-config-view", title = "Class: Config.View", path = "./lua/nvim_tree/_meta/config/view.lua", },
14-
{ helptag = "nvim-tree-config-renderer", title = "Class: Config.Renderer", path = "./lua/nvim_tree/_meta/config/renderer.lua", },
15-
{ helptag = "nvim-tree-config-hijack-directories", title = "Class: Config.HijackDirectories", path = "./lua/nvim_tree/_meta/config/hijack_directories.lua", },
16-
{ helptag = "nvim-tree-config-update-focused-file", title = "Class: Config.UpdateFocusedFile", path = "./lua/nvim_tree/_meta/config/update_focused_file.lua", },
17-
{ helptag = "nvim-tree-config-system-open", title = "Class: Config.SystemOpen", path = "./lua/nvim_tree/_meta/config/system_open.lua", },
18-
{ helptag = "nvim-tree-config-git", title = "Class: Config.Git", path = "./lua/nvim_tree/_meta/config/git.lua", },
19-
{ helptag = "nvim-tree-config-diagnostics", title = "Class: Config.Diagnostics", path = "./lua/nvim_tree/_meta/config/diagnostics.lua", },
20-
{ helptag = "nvim-tree-config-modified", title = "Class: Config.Modified", path = "./lua/nvim_tree/_meta/config/modified.lua", },
21-
{ helptag = "nvim-tree-config-filters", title = "Class: Config.Filters", path = "./lua/nvim_tree/_meta/config/filters.lua", },
22-
{ helptag = "nvim-tree-config-live-filter", title = "Class: Config.LiveFilter", path = "./lua/nvim_tree/_meta/config/live_filter.lua", },
23-
{ helptag = "nvim-tree-config-filesystem-watchers", title = "Class: Config.FilesystemWatchers", path = "./lua/nvim_tree/_meta/config/filesystem_watchers.lua", },
24-
{ helptag = "nvim-tree-config-actions", title = "Class: Config.Actions", path = "./lua/nvim_tree/_meta/config/actions.lua", },
25-
{ helptag = "nvim-tree-config-trash", title = "Class: Config.Trash", path = "./lua/nvim_tree/_meta/config/trash.lua", },
26-
{ helptag = "nvim-tree-config-tab", title = "Class: Config.Tab", path = "./lua/nvim_tree/_meta/config/tab.lua", },
27-
{ helptag = "nvim-tree-config-notify", title = "Class: Config.Notify", path = "./lua/nvim_tree/_meta/config/notify.lua", },
28-
{ helptag = "nvim-tree-config-bookmarks", title = "Class: Config.Bookmarks", path = "./lua/nvim_tree/_meta/config/bookmarks.lua", },
29-
{ helptag = "nvim-tree-config-help", title = "Class: Config.Help", path = "./lua/nvim_tree/_meta/config/help.lua", },
30-
{ helptag = "nvim-tree-config-ui", title = "Class: Config.UI", path = "./lua/nvim_tree/_meta/config/ui.lua", name = "UI", },
31-
{ helptag = "nvim-tree-config-experimental", title = "Class: Config.Experimental", path = "./lua/nvim_tree/_meta/config/experimental.lua", },
32-
{ helptag = "nvim-tree-config-log", title = "Class: Config.Log", path = "./lua/nvim_tree/_meta/config/log.lua", },
33-
34-
{ helptag = "nvim-tree-api-events", title = "Lua module: nvim_tree.api.events", path = "./lua/nvim_tree/api/events.lua", },
35-
{ helptag = "nvim-tree-api-filter", title = "Lua module: nvim_tree.api.filter", path = "./lua/nvim_tree/api/filter.lua", },
36-
{ helptag = "nvim-tree-api-fs", title = "Lua module: nvim_tree.api.fs", path = "./lua/nvim_tree/api/fs.lua", },
37-
{ helptag = "nvim-tree-api-health", title = "Lua module: nvim_tree.api.health", path = "./lua/nvim_tree/api/health.lua", },
38-
{ helptag = "nvim-tree-api-map", title = "Lua module: nvim_tree.api.map", path = "./lua/nvim_tree/api/map.lua", },
39-
{ helptag = "nvim-tree-api-marks", title = "Lua module: nvim_tree.api.marks", path = "./lua/nvim_tree/api/marks.lua", },
40-
{ helptag = "nvim-tree-api-tree", title = "Lua module: nvim_tree.api.tree", path = "./lua/nvim_tree/api/tree.lua", },
11+
{ helptag = "nvim-tree-config", title = "Class: Config", path = "./lua/nvim_tree/_meta/config.lua", },
12+
{ helptag = "nvim-tree-config-sort", title = "Class: Config.Sort", path = "./lua/nvim_tree/_meta/config/sort.lua", },
13+
{ helptag = "nvim-tree-config-view", title = "Class: Config.View", path = "./lua/nvim_tree/_meta/config/view.lua", },
14+
{ helptag = "nvim-tree-config-renderer", title = "Class: Config.Renderer", path = "./lua/nvim_tree/_meta/config/renderer.lua", },
15+
{ helptag = "nvim-tree-config-hijack-directories", title = "Class: Config.HijackDirectories", path = "./lua/nvim_tree/_meta/config/hijack_directories.lua", },
16+
{ helptag = "nvim-tree-config-update-focused-file", title = "Class: Config.UpdateFocusedFile", path = "./lua/nvim_tree/_meta/config/update_focused_file.lua", },
17+
{ helptag = "nvim-tree-config-system-open", title = "Class: Config.SystemOpen", path = "./lua/nvim_tree/_meta/config/system_open.lua", },
18+
{ helptag = "nvim-tree-config-git", title = "Class: Config.Git", path = "./lua/nvim_tree/_meta/config/git.lua", },
19+
{ helptag = "nvim-tree-config-diagnostics", title = "Class: Config.Diagnostics", path = "./lua/nvim_tree/_meta/config/diagnostics.lua", },
20+
{ helptag = "nvim-tree-config-modified", title = "Class: Config.Modified", path = "./lua/nvim_tree/_meta/config/modified.lua", },
21+
{ helptag = "nvim-tree-config-filters", title = "Class: Config.Filters", path = "./lua/nvim_tree/_meta/config/filters.lua", },
22+
{ helptag = "nvim-tree-config-live-filter", title = "Class: Config.LiveFilter", path = "./lua/nvim_tree/_meta/config/live_filter.lua", },
23+
{ helptag = "nvim-tree-config-filesystem-watchers", title = "Class: Config.FilesystemWatchers", path = "./lua/nvim_tree/_meta/config/filesystem_watchers.lua", },
24+
{ helptag = "nvim-tree-config-actions", title = "Class: Config.Actions", path = "./lua/nvim_tree/_meta/config/actions.lua", },
25+
{ helptag = "nvim-tree-config-trash", title = "Class: Config.Trash", path = "./lua/nvim_tree/_meta/config/trash.lua", },
26+
{ helptag = "nvim-tree-config-tab", title = "Class: Config.Tab", path = "./lua/nvim_tree/_meta/config/tab.lua", },
27+
{ helptag = "nvim-tree-config-notify", title = "Class: Config.Notify", path = "./lua/nvim_tree/_meta/config/notify.lua", },
28+
{ helptag = "nvim-tree-config-bookmarks", title = "Class: Config.Bookmarks", path = "./lua/nvim_tree/_meta/config/bookmarks.lua", },
29+
{ helptag = "nvim-tree-config-help", title = "Class: Config.Help", path = "./lua/nvim_tree/_meta/config/help.lua", },
30+
{ helptag = "nvim-tree-config-ui", title = "Class: Config.UI", path = "./lua/nvim_tree/_meta/config/ui.lua", name = "UI", },
31+
{ helptag = "nvim-tree-config-experimental", title = "Class: Config.Experimental", path = "./lua/nvim_tree/_meta/config/experimental.lua", },
32+
{ helptag = "nvim-tree-config-log", title = "Class: Config.Log", path = "./lua/nvim_tree/_meta/config/log.lua", },
33+
34+
{ helptag = "nvim-tree-api-commands", title = "Lua module: nvim_tree.api.commands", path = "./lua/nvim_tree/api/commands.lua", },
35+
{ helptag = "nvim-tree-api-events", title = "Lua module: nvim_tree.api.events", path = "./lua/nvim_tree/api/events.lua", },
36+
{ helptag = "nvim-tree-api-filter", title = "Lua module: nvim_tree.api.filter", path = "./lua/nvim_tree/api/filter.lua", },
37+
{ helptag = "nvim-tree-api-fs", title = "Lua module: nvim_tree.api.fs", path = "./lua/nvim_tree/api/fs.lua", },
38+
{ helptag = "nvim-tree-api-health", title = "Lua module: nvim_tree.api.health", path = "./lua/nvim_tree/api/health.lua", },
39+
{ helptag = "nvim-tree-api-map", title = "Lua module: nvim_tree.api.map", path = "./lua/nvim_tree/api/map.lua", },
40+
{ helptag = "nvim-tree-api-marks", title = "Lua module: nvim_tree.api.marks", path = "./lua/nvim_tree/api/marks.lua", },
41+
{ helptag = "nvim-tree-api-tree", title = "Lua module: nvim_tree.api.tree", path = "./lua/nvim_tree/api/tree.lua", },
4142
}
4243

4344
-- hydrate file names

0 commit comments

Comments
 (0)