Skip to content

Commit ae6f43b

Browse files
committed
perf(#3257): remove tree init
1 parent f96d533 commit ae6f43b

File tree

4 files changed

+12
-26
lines changed

4 files changed

+12
-26
lines changed

lua/nvim-tree.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ local api = require("nvim-tree.api")
22
local log = require("nvim-tree.log")
33
local view = require("nvim-tree.view")
44
local utils = require("nvim-tree.utils")
5-
local actions = require("nvim-tree.actions")
5+
local find_file = require("nvim-tree.actions.tree.find-file")
6+
local change_dir = require("nvim-tree.actions.tree.change-dir")
67
local core = require("nvim-tree.core")
78
local notify = require("nvim-tree.notify")
89
local config = require("nvim-tree.config")
@@ -169,7 +170,7 @@ local function setup_autocommands()
169170
if config.g.sync_root_with_cwd then
170171
create_nvim_tree_autocmd("DirChanged", {
171172
callback = function()
172-
actions.tree.change_dir.fn(vim.loop.cwd())
173+
change_dir.fn(vim.loop.cwd())
173174
end,
174175
})
175176
end
@@ -181,7 +182,7 @@ local function setup_autocommands()
181182
return
182183
end
183184
utils.debounce("BufEnter:find_file", config.g.view.debounce_delay, function()
184-
actions.tree.find_file.fn()
185+
find_file.fn()
185186
end)
186187
end,
187188
})

lua/nvim-tree/actions/init.lua

Lines changed: 0 additions & 5 deletions
This file was deleted.

lua/nvim-tree/actions/tree/init.lua

Lines changed: 0 additions & 10 deletions
This file was deleted.

lua/nvim-tree/api/impl.lua

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ function M.hydrate_post_setup(api)
184184

185185
api.node.buffer.delete = _n(function(n, opts) require("nvim-tree.actions.node.buffer").delete(n, opts) end)
186186
api.node.buffer.wipe = _n(function(n, opts) require("nvim-tree.actions.node.buffer").wipe(n, opts) end)
187-
api.node.collapse = _n(function(n, opts) require("nvim-tree.actions").tree.collapse.node(n, opts) end)
187+
api.node.collapse = _n(function(n, opts) require("nvim-tree.actions.tree.collapse").node(n, opts) end)
188188
api.node.expand = en(function(e, n, opts) e:expand_node(n, opts) end)
189189
api.node.navigate.diagnostics.next = __(function() require("nvim-tree.actions.moves.item").diagnostics_next() end)
190190
api.node.navigate.diagnostics.next_recursive = __(function() require("nvim-tree.actions.moves.item").diagnostics_next_recursive() end)
@@ -221,26 +221,26 @@ function M.hydrate_post_setup(api)
221221
api.node.run.system = _n(function(n) require("nvim-tree.actions.node.system-open").fn(n) end)
222222
api.node.show_info_popup = _n(function(n) require("nvim-tree.actions.node.file-popup").toggle_file_info(n) end)
223223

224-
api.tree.change_root = __(function(path) require("nvim-tree.actions").tree.change_dir.fn(path) end)
224+
api.tree.change_root = __(function(path) require("nvim-tree.actions.tree.change-dir").fn(path) end)
225225
api.tree.change_root_to_node = en(function(e, n) e:change_dir_to_node(n) end)
226226
api.tree.change_root_to_parent = en(function(e, n) e:dir_up(n) end)
227227
api.tree.close = __(function() require("nvim-tree.view").close() end)
228228
api.tree.close_in_all_tabs = __(function() require("nvim-tree.view").close_all_tabs() end)
229229
api.tree.close_in_this_tab = __(function() require("nvim-tree.view").close_this_tab_only() end)
230-
api.tree.collapse_all = __(function(opts) require("nvim-tree.actions").tree.collapse.all(opts) end)
230+
api.tree.collapse_all = __(function(opts) require("nvim-tree.actions.tree.collapse").all(opts) end)
231231
api.tree.expand_all = en(function(e, n, opts) e:expand_all(n, opts) end)
232-
api.tree.find_file = __(function(opts) require("nvim-tree.actions").tree.find_file.fn(opts) end)
233-
api.tree.focus = __(function(opts) require("nvim-tree.actions").tree.open.fn(opts) end)
232+
api.tree.find_file = __(function(opts) require("nvim-tree.actions.tree.find_file").fn(opts) end)
233+
api.tree.focus = __(function(opts) require("nvim-tree.actions.tree.open").fn(opts) end)
234234
api.tree.get_node_under_cursor = en(function(e) return e:get_node_at_cursor() end)
235235
api.tree.get_nodes = en(function(e) return e:get_nodes() end)
236236
api.tree.is_tree_buf = __(function(bufnr) return require("nvim-tree.utils").is_nvim_tree_buf(bufnr) end)
237237
api.tree.is_visible = __(function(opts) return require("nvim-tree.view").is_visible(opts) end)
238-
api.tree.open = __(function(opts) require("nvim-tree.actions").tree.open.fn(opts) end)
238+
api.tree.open = __(function(opts) require("nvim-tree.actions.tree.open").fn(opts) end)
239239
api.tree.reload = e_(function(e) e:reload_explorer() end)
240240
api.tree.reload_git = e_(function(e) e:reload_git() end)
241-
api.tree.resize = __(function(opts) require("nvim-tree.actions").tree.resize.fn(opts) end)
241+
api.tree.resize = __(function(opts) require("nvim-tree.actions.tree.resize").fn(opts) end)
242242
api.tree.search_node = __(function() require("nvim-tree.actions.finders.search-node").fn() end)
243-
api.tree.toggle = __(function(opts) require("nvim-tree.actions").tree.toggle.fn(opts) end)
243+
api.tree.toggle = __(function(opts) require("nvim-tree.actions.tree.toggle").fn(opts) end)
244244
api.tree.toggle_help = __(function() require("nvim-tree.help").toggle() end)
245245
api.tree.winid = __(function(opts) return require("nvim-tree.view").winid(opts) end)
246246

0 commit comments

Comments
 (0)