File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ local core = require " nvim-tree.core"
2
+ local renderer = require " nvim-tree.renderer"
3
+
4
+ local M = {}
5
+
6
+ local function expand (node )
7
+ node .open = true
8
+ if # node .nodes == 0 then
9
+ core .get_explorer ():expand (node )
10
+ end
11
+ end
12
+
13
+ local function iterate (_node )
14
+ for _ , node in pairs (_node .nodes ) do
15
+ if node .nodes and not node .open then
16
+ expand (node )
17
+ end
18
+
19
+ if node .open then
20
+ iterate (node )
21
+ end
22
+ end
23
+ end
24
+
25
+ function M .fn ()
26
+ iterate (core .get_explorer ())
27
+ renderer .draw ()
28
+ end
29
+
30
+ return M
Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ local M = {
45
45
{ key = " q" , action = " close" },
46
46
{ key = " g?" , action = " toggle_help" },
47
47
{ key = " W" , action = " collapse_all" },
48
+ { key = " E" , action = " expand_all" },
48
49
{ key = " S" , action = " search_node" },
49
50
{ key = " ." , action = " run_file_command" },
50
51
{ key = " <C-k>" , action = " toggle_file_info" },
@@ -57,6 +58,7 @@ local keypress_funcs = {
57
58
close = view .close ,
58
59
close_node = require (" nvim-tree.actions.movements" ).parent_node (true ),
59
60
collapse_all = require (" nvim-tree.actions.collapse-all" ).fn ,
61
+ expand_all = require (" nvim-tree.actions.expand-all" ).fn ,
60
62
copy_absolute_path = require (" nvim-tree.actions.copy-paste" ).copy_absolute_path ,
61
63
copy_name = require (" nvim-tree.actions.copy-paste" ).copy_filename ,
62
64
copy_path = require (" nvim-tree.actions.copy-paste" ).copy_path ,
You can’t perform that action at this time.
0 commit comments