File tree 6 files changed +13
-14
lines changed
6 files changed +13
-14
lines changed Original file line number Diff line number Diff line change @@ -250,9 +250,9 @@ via |nvim-tree.on_attach| e.g. >
250
250
251
251
Open the tree if it is closed, and then focus on the tree.
252
252
253
- See | nvim-tree-api.tree.focus () |
253
+ See | nvim-tree-api.tree.open () |
254
254
255
- Calls: `api.tree.focus ()`
255
+ Calls: `api.tree.open ()`
256
256
257
257
*:NvimTreeRefresh*
258
258
@@ -1587,6 +1587,7 @@ tree.close_in_all_tabs() *nvim-tree-api.tree.close_in_all_tabs()*
1587
1587
1588
1588
tree.focus() *nvim-tree-api.tree.focus()*
1589
1589
Focus the tree, opening it if necessary.
1590
+ Retained for compatibility, use | tree.open() | with no arguments instead.
1590
1591
1591
1592
tree.reload() *nvim-tree-api.tree.reload()*
1592
1593
Refresh the tree. Does nothing if closed.
Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ local git = require "nvim-tree.git"
13
13
local filters = require " nvim-tree.explorer.filters"
14
14
local modified = require " nvim-tree.modified"
15
15
local find_file = require " nvim-tree.actions.tree.find-file"
16
- local open = require " nvim-tree.actions.tree.open"
17
16
local events = require " nvim-tree.events"
18
17
local notify = require " nvim-tree.notify"
19
18
@@ -23,11 +22,6 @@ local M = {
23
22
init_root = " " ,
24
23
}
25
24
26
- function M .focus ()
27
- open .fn ()
28
- view .focus ()
29
- end
30
-
31
25
--- Update the tree root to a directory or the directory containing
32
26
--- @param path string relative or absolute
33
27
--- @param bufnr number | nil
@@ -758,7 +752,7 @@ function M.purge_all_state()
758
752
view .abandon_all_windows ()
759
753
if core .get_explorer () ~= nil then
760
754
git .purge_state ()
761
- TreeExplorer = nil
755
+ core . reset_explorer ()
762
756
end
763
757
end
764
758
Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ Api.tree.close_in_this_tab = wrap(require("nvim-tree.view").close_this_tab_only)
86
86
Api .tree .close_in_all_tabs = wrap (require (" nvim-tree.view" ).close_all_tabs )
87
87
88
88
Api .tree .focus = wrap (function ()
89
- require ( " nvim- tree" ). focus ()
89
+ Api . tree . open ()
90
90
end )
91
91
92
92
Api .tree .reload = wrap (require (" nvim-tree.actions.reloaders.reloaders" ).reload_explorer )
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ local CMDS = {
48
48
bar = true ,
49
49
},
50
50
command = function ()
51
- api .tree .focus ()
51
+ api .tree .open ()
52
52
end ,
53
53
},
54
54
{
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ local log = require "nvim-tree.log"
6
6
7
7
local M = {}
8
8
9
- TreeExplorer = nil
9
+ local TreeExplorer = nil
10
10
local first_init_done = false
11
11
12
12
function M .init (foldername )
@@ -27,6 +27,10 @@ function M.get_explorer()
27
27
return TreeExplorer
28
28
end
29
29
30
+ function M .reset_explorer ()
31
+ TreeExplorer = nil
32
+ end
33
+
30
34
function M .get_cwd ()
31
35
return TreeExplorer and TreeExplorer .absolute_path
32
36
end
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ local function redraw()
11
11
end
12
12
13
13
local function reset_filter (node_ )
14
- node_ = node_ or TreeExplorer
14
+ node_ = node_ or require ( " nvim-tree.core " ). get_explorer ()
15
15
Iterator .builder (node_ .nodes )
16
16
:hidden ()
17
17
:applier (function (node )
@@ -79,7 +79,7 @@ function M.apply_filter(node_)
79
79
node .hidden = not (has_nodes or (ok and is_match ))
80
80
end
81
81
82
- iterate (node_ or TreeExplorer )
82
+ iterate (node_ or require ( " nvim-tree.core " ). get_explorer () )
83
83
end
84
84
85
85
local function record_char ()
You can’t perform that action at this time.
0 commit comments