feat(#2598): add api.tree.resize (#2811)

* feat(#2598): Implemented API `tree.resize`

* rely on  when resize

* Fix docs

---------

Co-authored-by: Alexander Courtis <alex@courtis.org>
This commit is contained in:
Vladimir Levin
2024-07-11 14:15:40 +09:00
committed by GitHub
parent 12a9a995a4
commit 2ede0de67b
5 changed files with 107 additions and 9 deletions

View File

@@ -1670,6 +1670,22 @@ tree.focus() *nvim-tree-api.tree.focus()*
tree.reload() *nvim-tree-api.tree.reload()*
Refresh the tree. Does nothing if closed.
tree.resize({opts}) *nvim-tree-api.tree.resize()*
Resize the tree, persisting the new size.
Resets to |nvim-tree.view.width| when no {opts} provided.
See |:NvimTreeResize|
Parameters: ~
• {opts} (table) optional parameters
Options: ~
• {width} (table) new |nvim-tree.view.width| value
• {absolute} (number) set the width
• {relative} (number) increase or decrease the width
Only one option is supported, in the priority order above.
{absolute} and {relative} do nothing when {width} is a function.
tree.change_root({path}) *nvim-tree-api.tree.change_root()*
Change the tree's root to a path.
@@ -3001,6 +3017,7 @@ highlight group is not, hard linking as follows: >
|nvim-tree-api.tree.is_visible()|
|nvim-tree-api.tree.open()|
|nvim-tree-api.tree.reload()|
|nvim-tree-api.tree.resize()|
|nvim-tree-api.tree.search_node()|
|nvim-tree-api.tree.toggle()|
|nvim-tree-api.tree.toggle_custom_filter()|