Skip to content

Commit 37984b4

Browse files
committed
use node.explorer
1 parent a402d30 commit 37984b4

File tree

5 files changed

+8
-16
lines changed

5 files changed

+8
-16
lines changed

lua/nvim-tree/actions/fs/clipboard.lua

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,8 @@ end
218218
---@param action_fn fun(source: string, dest: string)
219219
function Clipboard:do_paste(node, action, action_fn)
220220
node = node:last_group_node()
221-
local explorer = core.get_explorer()
222-
if node.name == ".." and explorer then
223-
node = explorer
221+
if node.name == ".." then
222+
node = self.explorer
224223
end
225224
local clip = self.data[action]
226225
if #clip == 0 then

lua/nvim-tree/explorer/init.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function Explorer:new(path)
5555
local o = DirectoryNode.new(self, placeholder, nil, path, "..", nil)
5656
---@cast o Explorer
5757

58-
o.explorer = self
58+
o.explorer = o
5959
o.open = true
6060

6161
o.opts = config

lua/nvim-tree/explorer/watch.lua

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,9 @@ function M.create_watcher(node)
7676
else
7777
log.line("watcher", "node event executing refresh '%s'", node.absolute_path)
7878
end
79-
local explorer = require("nvim-tree.core").get_explorer()
80-
if explorer then
81-
explorer:refresh_node(node, function()
82-
explorer.renderer:draw()
83-
end)
84-
end
79+
node.explorer:refresh_node(node, function()
80+
node.explorer.renderer:draw()
81+
end)
8582
end)
8683
end
8784

lua/nvim-tree/git/init.lua

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,7 @@ local function reload_tree_at(toplevel)
219219
end)
220220
:iterate()
221221

222-
local explorer = require("nvim-tree.core").get_explorer()
223-
if explorer then
224-
explorer.renderer:draw()
225-
end
222+
root_node.explorer.renderer:draw()
226223
end)
227224
end
228225

lua/nvim-tree/utils.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,7 @@ function M.find_node(nodes, fn)
112112
end)
113113
:iterate()
114114
i = require("nvim-tree.view").is_root_folder_visible() and i or i - 1
115-
local explorer = require("nvim-tree.core").get_explorer()
116-
if explorer and explorer.live_filter.filter then
115+
if node and node.explorer.live_filter.filter then
117116
i = i + 1
118117
end
119118
return node, i

0 commit comments

Comments
 (0)