From 2e25ba5958cd5b915806ea54ce859a61cb20f12b Mon Sep 17 00:00:00 2001 From: Wen Jun <48018016+defpis@users.noreply.github.com> Date: Fri, 21 Jan 2022 18:29:17 +0800 Subject: [PATCH] feat(preview): enhanced preview to toggle folder (#907) Co-authored-by: MusiCool --- lua/nvim-tree.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lua/nvim-tree.lua b/lua/nvim-tree.lua index fec2ba2a..dc076b98 100644 --- a/lua/nvim-tree.lua +++ b/lua/nvim-tree.lua @@ -95,7 +95,12 @@ local keypress_funcs = { dir_up = lib.dir_up, close = function() M.close() end, preview = function(node) - if node.entries ~= nil or node.name == '..' then return end + if node.entries ~= nil then + if (node.name == '..') then + return + end + return lib.expand_or_collapse(node) + end return lib.open_file('preview', node.absolute_path) end, system_open = require'nvim-tree.actions.system-open'.fn,