File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed
lua/nvim-tree/actions/tree/modifiers Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -23,21 +23,30 @@ local function buf_match()
2323 end
2424end
2525
26+ --- @param node Node
2627--- @param keep_buffers boolean
27- function M .fn (keep_buffers )
28+ function M .fn (node , keep_buffers )
2829 local explorer = core .get_explorer ()
2930 if not explorer then
3031 return
3132 end
3233
33- local node = explorer :get_node_at_cursor ()
34- if not node then
34+ local nodeAtCursor = explorer :get_node_at_cursor ()
35+ if not nodeAtCursor then
3536 return
3637 end
3738
3839 local matches = buf_match ()
3940
40- Iterator .builder (explorer .nodes )
41+ local nodesToIterate = explorer .nodes
42+ if node then
43+ local dir = node :as (DirectoryNode )
44+ if dir then
45+ nodesToIterate = { dir }
46+ end
47+ end
48+
49+ Iterator .builder (nodesToIterate )
4150 :hidden ()
4251 :applier (function (n )
4352 local dir = n :as (DirectoryNode )
@@ -51,7 +60,7 @@ function M.fn(keep_buffers)
5160 :iterate ()
5261
5362 explorer .renderer :draw ()
54- utils .focus_node_or_parent (node )
63+ utils .focus_node_or_parent (nodeAtCursor )
5564end
5665
5766return M
You can’t perform that action at this time.
0 commit comments