fix: api.node.open.preview should toggle directories (#2099)

This commit is contained in:
gegoune 2023-04-03 09:20:23 +03:00 committed by GitHub
parent 0c9bfe7225
commit 7ad1c204c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -130,11 +130,13 @@ local function open_or_expand_or_dir_up(mode)
end
local function open_preview(node)
if node.nodes or node.name == ".." then
return
if node.name == ".." then
require("nvim-tree.actions.root.change-dir").fn ".."
elseif node.nodes then
require("nvim-tree.lib").expand_or_collapse(node)
else
edit("preview", node)
end
edit("preview", node)
end
Api.node.open.edit = inject_node(open_or_expand_or_dir_up "edit")