feat(api): api.tree.open/toggle: add current_window option (#1935)

* feat(api): api.tree.open: add current_window option

* feat(api): api.tree.toggle: add current_window option

* feat(api): api.tree.toggle: add current_window option

* doc: api.tree.*

* doc: api.tree.*
This commit is contained in:
Alexander Courtis
2023-01-24 08:30:49 +11:00
committed by GitHub
parent 16f2806d59
commit f1c2d6d372
4 changed files with 200 additions and 36 deletions

View File

@@ -1238,27 +1238,118 @@ that injects the node from the cursor position in the tree when calling
the function. It will use the node you pass as an argument in priority if it
exists.
- api.tree: *nvim-tree.api.tree*
- open `(path?: string)`
- close
- toggle `(find_file?: bool, no_focus?: bool, path?: string)`
- focus
- reload
- change_root `(path: string)`
- change_root_to_node
- change_root_to_parent
- get_node_under_cursor
- get_nodes
- find_file `(filename: string)`
- search_node
- collapse_all `(keep_buffers?: bool)`
- expand_all
- toggle_gitignore_filter
- toggle_git_clean_filter
- toggle_no_buffer_filter
- toggle_custom_filter
- toggle_hidden_filter
- toggle_help
api.tree.open({opts}) *nvim-tree.api.tree.open()*
Open the tree, focusing it if already open.
Parameters: ~
• {opts} (table) optional parameters
Options: ~
• {path} (string) root directory for the tree
• {current_window} (boolean) open the tree in the current window
api.tree.toggle({opts}) *nvim-tree.api.tree.toggle()*
Open or close the tree.
Parameters: ~
• {opts} (table) optional parameters
Options: ~
• {path} (string) root directory for the tree
• {current_window} (boolean) open the tree in the current window
• {focus} (boolean) focus the tree when opening
• {find_file} (boolean) find the current buffer
• {update_root} (boolean) see |nvim-tree.update_focused_file.update_root|
api.tree.close() *nvim-tree.api.tree.close()*
Close the tree, affecting all tabs as per |nvim-tree.tab.sync.close|
api.tree.close_in_this_tab() *nvim-tree.api.tree.close_in_this_tab()*
Close the tree in this tab only.
api.tree.close_in_all_tabs() *nvim-tree.api.tree.close_in_all_tabs()*
Close the tree in all tabs.
api.tree.focus() *nvim-tree.api.tree.focus()*
Focus the tree, opening it if necessary.
api.tree.reload() *nvim-tree.api.tree.focus()*
Refresh the tree. Does nothing if closed.
api.tree.change_root({path}) *nvim-tree.api.tree.change_root()*
Change the tree's root to a path.
Parameters: ~
• {path} (string) absolute or relative path
*nvim-tree.api.tree.change_root_to_node()*
api.tree.change_root_to_node({node})
Change the tree's root to a folder node or the parent of a file node.
Parameters: ~
• {node} (Node) folder or file
*nvim-tree.api.tree.change_root_to_parent()*
api.tree.change_root_to_parent({node})
Change the tree's root to the parent of a node.
Parameters: ~
• {node} (Node) folder or file
api.tree.get_node_under_cursor() *nvim-tree.api.tree.get_node_under_cursor()*
Retrieve the currently focused node.
Return: ~
node or nil if tree is not visible
api.tree.get_nodes() *nvim-tree.api.tree.get_nodes()*
Retrieve a hierarchical list of all the nodes. This is a cloned list for
reference purposes only and should not be passed into other API functions.
Return: ~
table of nodes
api.tree.find_file({path}) *nvim-tree.api.tree.find_file()*
Find and focus a file or folder in the tree.
Parameters: ~
• {path} (string) absolute path
api.tree.search_node() *nvim-tree.api.tree.search_node()*
Open the search dialogue as per the search_node action.
api.tree.collapse_all({keep_buffers}) *nvim-tree.api.tree.collapse_all()*
Collapse the tree.
Parameters: ~
• {keep_buffers} (boolean) do not collapse nodes with open buffers.
api.tree.expand_all({keep_buffers}) *nvim-tree.api.tree.expand_all()*
Expand all nodes in the tree.
*nvim-tree.api.tree.toggle_gitignore_filter()*
api.tree.toggle_gitignore_filter()
Toggle |nvim-tree.git.ignore| filter.
*nvim-tree.api.tree.toggle_git_clean_filter()*
api.tree.toggle_git_clean_filter()
Toggle |nvim-tree.filters.git_clean| filter.
*nvim-tree.api.tree.toggle_no_buffer_filter()*
api.tree.toggle_no_buffer_filter()
Toggle |nvim-tree.filters.no_buffer| filter.
*nvim-tree.api.tree.toggle_custom_filter()*
api.tree.toggle_custom_filter()
Toggle |nvim-tree.filters.custom| filter.
*nvim-tree.api.tree.toggle_hidden_filter()*
api.tree.toggle_hidden_filter()
Toggle |nvim-tree.filters.dotfiles| filter.
api.tree.toggle_help() *nvim-tree.api.tree.toggle_help()*
Toggle help view.
- api.fs: *nvim-tree.api.fs*
- create