-
-
Notifications
You must be signed in to change notification settings - Fork 638
Closed
Labels
Description
Why this feature request?
I've used vscode's vim extension for a while. When I used explorer in vscode, I found a nice functionality, I can use h to collapse a folder if opened or go to the parent node if collapsed. So I try to implement this in my nvim like this:
local node = api.tree.get_node_under_cursor()
if node == nil then
return
end
if vim.fn.isdirectory(node.absolute_path) == 1 then
-- there should be an API to get the status of the directory node
if node is not opened then
api.node.navigate.parent(node)
else
api.node.open.edit(node)
end
endI've checked the exposed APIs and not found any related APIs.
Solution
I've checked the source code directory.lua, may expose a new API returning the value of self:last_group_node().open in the file.