File tree 1 file changed +14
-5
lines changed
lua/nvim-tree/actions/tree/modifiers
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()
23
23
end
24
24
end
25
25
26
+ --- @param node Node
26
27
--- @param keep_buffers boolean
27
- function M .fn (keep_buffers )
28
+ function M .fn (node , keep_buffers )
28
29
local explorer = core .get_explorer ()
29
30
if not explorer then
30
31
return
31
32
end
32
33
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
35
36
return
36
37
end
37
38
38
39
local matches = buf_match ()
39
40
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 )
41
50
:hidden ()
42
51
:applier (function (n )
43
52
local dir = n :as (DirectoryNode )
@@ -51,7 +60,7 @@ function M.fn(keep_buffers)
51
60
:iterate ()
52
61
53
62
explorer .renderer :draw ()
54
- utils .focus_node_or_parent (node )
63
+ utils .focus_node_or_parent (nodeAtCursor )
55
64
end
56
65
57
66
return M
You can’t perform that action at this time.
0 commit comments