Skip to content

Commit cdf1148

Browse files
committed
docs(#3088): remove command descriptions, show lua, link to api
1 parent fdba900 commit cdf1148

1 file changed

Lines changed: 55 additions & 86 deletions

File tree

doc/nvim-tree-lua.txt

Lines changed: 55 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -251,106 +251,75 @@ See |nvim-tree-highlight-groups| for details.
251251
==============================================================================
252252
Commands *nvim-tree-commands*
253253

254-
TODO #3088 clean up descriptions and render call as Lua.
254+
Commands may be executed with a `<bang>` (`!`) or take a `<path>` string argument.
255255

256-
*:NvimTreeOpen*
256+
*:NvimTreeOpen* |nvim_tree.api.tree.open()| >lua
257257

258-
Opens the tree. See |nvim_tree.api.tree.open()|
259-
260-
Calls: `api.tree.open({ path = "<args>" })`
261-
262-
*:NvimTreeClose*
263-
264-
Closes the tree. See |nvim_tree.api.tree.close()|
265-
266-
Calls: `api.tree.close()`
267-
268-
*:NvimTreeToggle*
269-
270-
Open or close the tree. See |nvim_tree.api.tree.toggle()|
271-
272-
Calls: `api.tree.toggle({ path = "<args>", find_file = false, update_root = false, focus = true, })`
273-
274-
*:NvimTreeFocus*
275-
276-
Open the tree if it is closed, and then focus on the tree.
277-
278-
See |nvim_tree.api.tree.open()|
279-
280-
Calls: `api.tree.open()`
281-
282-
*:NvimTreeRefresh*
283-
284-
Refresh the tree. See |nvim_tree.api.tree.reload()|
285-
286-
Calls: `api.tree.reload()`
287-
288-
*:NvimTreeFindFile*
289-
290-
The command will change the cursor in the tree for the current bufname.
291-
292-
It will also open the leafs of the tree leading to the file in the buffer
293-
(if you opened a file with something else than the NvimTree, like `fzf` or
294-
`:split`)
295-
296-
Invoke with a bang `:NvimTreeFindFile!` to update the root.
297-
298-
See |nvim_tree.api.tree.find_file()|
299-
300-
Calls: `api.tree.find_file({ update_root = <bang>, open = true, focus = true, })`
258+
require("nvim-tree.api").tree.open({
259+
path = "<args>"
260+
})
261+
<
262+
*:NvimTreeClose* |nvim_tree.api.tree.close()| >lua
301263

302-
*:NvimTreeFindFileToggle*
264+
require("nvim-tree.api").tree.close()
265+
<
266+
*:NvimTreeToggle* |nvim_tree.api.tree.toggle()| >lua
303267

304-
close the tree or change the cursor in the tree for the current bufname,
305-
similar to combination of |:NvimTreeToggle| and |:NvimTreeFindFile|. Takes an
306-
optional path argument.
268+
require("nvim-tree.api").tree.toggle({
269+
path = "<args>",
270+
find_file = false,
271+
update_root = false,
272+
focus = true,
273+
})
274+
<
275+
*:NvimTreeFocus* |nvim_tree.api.tree.open()| >lua
307276

308-
Invoke with a bang `:NvimTreeFindFileToggle!` to update the root.
277+
require("nvim-tree.api").tree.open()
278+
<
279+
*:NvimTreeRefresh* |nvim_tree.api.tree.reload()| >lua
309280

310-
See |nvim_tree.api.tree.toggle()|
281+
require("nvim-tree.api").tree.reload()
282+
<
283+
*:NvimTreeFindFile* |nvim_tree.api.tree.find_file()| >lua
311284

312-
Calls: `api.tree.toggle({ path = "<args>", update_root = <bang>, find_file = true, focus = true, })`
285+
require("nvim-tree.api").tree.find_file({
286+
open = true,
287+
update_root = "<bang>",
288+
focus = true,
289+
})
290+
<
291+
*:NvimTreeFindFileToggle* |nvim_tree.api.tree.toggle()| >lua
313292

314-
*:NvimTreeClipboard*
293+
require("nvim-tree.api").tree.toggle({
294+
path = "<args>",
295+
find_file = true,
296+
update_root = "<bang>",
297+
focus = true,
298+
})
299+
<
300+
*:NvimTreeClipboard* |nvim-tree-api.fs.print_clipboard()| >lua
315301

316-
Print clipboard content for both cut and copy
302+
require("nvim-tree.api").fs.print_clipboard()
303+
<
304+
*:NvimTreeCollapse* |nvim_tree.api.tree.collapse_all()| >lua
317305

318-
See |nvim-tree-api.fs.print_clipboard()|
306+
require("nvim-tree.api").tree.collapse_all({
307+
keep_buffers = false
308+
})
309+
<
310+
*:NvimTreeCollapseKeepBuffers* |nvim_tree.api.tree.collapse_all()| >lua
319311

320-
Calls: `api.fs.print_clipboard()`
312+
require("nvim-tree.api").tree.collapse_all({
313+
keep_buffers = true
314+
})
315+
<
316+
*:NvimTreeHiTest* |nvim_tree.api.health.hi_test()| >lua
321317

318+
require("nvim-tree.api").health.hi_test()
319+
<
322320
*:NvimTreeResize*
323321

324-
Resize the NvimTree window to the given size. Example: `:NvimTreeResize 50`
325-
resizes the window to the width of 50. If the size starts with "+" or "-" it
326-
adds or removes the given value to the current window width.
327-
Example `:NvimTreeResize -20` removes the value 20 from the current width. And
328-
`:NvimTreeResize +20` adds the value 20 to the current width.
329-
330-
*:NvimTreeCollapse*
331-
332-
Collapses the nvim-tree recursively.
333-
334-
See |nvim_tree.api.tree.collapse_all()|
335-
336-
Calls: `api.tree.collapse_all({ keep_buffers = false })`
337-
338-
*:NvimTreeCollapseKeepBuffers*
339-
340-
Collapses the nvim-tree recursively, but keep the directories open, which are
341-
used in an open buffer.
342-
343-
See |nvim_tree.api.tree.collapse_all()|
344-
345-
Calls: `api.tree.collapse_all({ keep_buffers = true })`
346-
347-
*:NvimTreeHiTest*
348-
349-
Show nvim-tree highlight groups similar to `:so $VIMRUNTIME/syntax/hitest.vim`
350-
351-
See |nvim_tree.api.health.hi_test()|
352-
353-
Calls: `api.health.hi_test()`
322+
Columns integer argument is absolute (e.g. `40`) or a delta (e.g. `-5`, `+5`)
354323

355324
==============================================================================
356325
Setup *nvim-tree-setup*

0 commit comments

Comments
 (0)