@@ -5,14 +5,12 @@ local renderer = require "nvim-tree.renderer"
55local view = require " nvim-tree.view"
66local commands = require " nvim-tree.commands"
77local utils = require " nvim-tree.utils"
8- local change_dir = require " nvim-tree.actions.root.change-dir "
8+ local actions = require " nvim-tree.actions"
99local legacy = require " nvim-tree.legacy"
1010local core = require " nvim-tree.core"
11- local reloaders = require " nvim-tree.actions.reloaders.reloaders"
1211local git = require " nvim-tree.git"
1312local filters = require " nvim-tree.explorer.filters"
1413local modified = require " nvim-tree.modified"
15- local find_file = require " nvim-tree.actions.tree.find-file"
1614local events = require " nvim-tree.events"
1715local notify = require " nvim-tree.notify"
1816
@@ -51,7 +49,7 @@ function M.change_root(path, bufnr)
5149 -- test if in vim_cwd
5250 if utils .path_relative (path , vim_cwd ) ~= path then
5351 if vim_cwd ~= cwd then
54- change_dir .fn (vim_cwd )
52+ actions . root . change_dir .fn (vim_cwd )
5553 end
5654 return
5755 end
@@ -62,19 +60,19 @@ function M.change_root(path, bufnr)
6260
6361 -- otherwise test M.init_root
6462 if _config .prefer_startup_root and utils .path_relative (path , M .init_root ) ~= path then
65- change_dir .fn (M .init_root )
63+ actions . root . change_dir .fn (M .init_root )
6664 return
6765 end
6866 -- otherwise root_dirs
6967 for _ , dir in pairs (_config .root_dirs ) do
7068 dir = vim .fn .fnamemodify (dir , " :p" )
7169 if utils .path_relative (path , dir ) ~= path then
72- change_dir .fn (dir )
70+ actions . root . change_dir .fn (dir )
7371 return
7472 end
7573 end
7674 -- finally fall back to the folder containing the file
77- change_dir .fn (vim .fn .fnamemodify (path , " :p:h" ))
75+ actions . root . change_dir .fn (vim .fn .fnamemodify (path , " :p:h" ))
7876end
7977
8078function M .tab_enter ()
@@ -87,7 +85,7 @@ function M.tab_enter()
8785 end
8886 end
8987 view .open { focus_tree = false }
90- require ( " nvim-tree. renderer" ) .draw ()
88+ renderer .draw ()
9189 end
9290end
9391
@@ -103,7 +101,7 @@ function M.open_on_directory()
103101 return
104102 end
105103
106- change_dir .force_dirchange (bufname , true )
104+ actions . root . change_dir .force_dirchange (bufname , true )
107105end
108106
109107function M .reset_highlight ()
@@ -154,11 +152,11 @@ end
154152--- @param name string | nil
155153function M .change_dir (name )
156154 if name then
157- change_dir .fn (name )
155+ actions . root . change_dir .fn (name )
158156 end
159157
160158 if _config .update_focused_file .enable then
161- find_file .fn ()
159+ actions . tree . find_file .fn ()
162160 end
163161end
164162
@@ -191,7 +189,7 @@ local function setup_autocommands(opts)
191189 create_nvim_tree_autocmd (" BufWritePost" , {
192190 callback = function ()
193191 if opts .auto_reload_on_write and not opts .filesystem_watchers .enable then
194- reloaders .reload_explorer ()
192+ actions . reloaders .reload_explorer ()
195193 end
196194 end ,
197195 })
@@ -201,7 +199,7 @@ local function setup_autocommands(opts)
201199 -- update opened file buffers
202200 if (filters .config .filter_no_buffer or renderer .config .highlight_opened_files ~= " none" ) and vim .bo [data .buf ].buftype == " " then
203201 utils .debounce (" Buf:filter_buffer" , opts .view .debounce_delay , function ()
204- reloaders .reload_explorer ()
202+ actions . reloaders .reload_explorer ()
205203 end )
206204 end
207205 end ,
@@ -212,7 +210,7 @@ local function setup_autocommands(opts)
212210 -- update opened file buffers
213211 if (filters .config .filter_no_buffer or renderer .config .highlight_opened_files ~= " none" ) and vim .bo [data .buf ].buftype == " " then
214212 utils .debounce (" Buf:filter_buffer" , opts .view .debounce_delay , function ()
215- reloaders .reload_explorer (nil , data .buf )
213+ actions . reloaders .reload_explorer (nil , data .buf )
216214 end )
217215 end
218216 end ,
@@ -222,7 +220,7 @@ local function setup_autocommands(opts)
222220 pattern = { " FugitiveChanged" , " NeogitStatusRefreshed" },
223221 callback = function ()
224222 if not opts .filesystem_watchers .enable and opts .git .enable then
225- reloaders .reload_git ()
223+ actions . reloaders .reload_git ()
226224 end
227225 end ,
228226 })
@@ -251,7 +249,7 @@ local function setup_autocommands(opts)
251249 create_nvim_tree_autocmd (" BufEnter" , {
252250 callback = function ()
253251 utils .debounce (" BufEnter:find_file" , opts .view .debounce_delay , function ()
254- find_file .fn ()
252+ actions . tree . find_file .fn ()
255253 end )
256254 end ,
257255 })
@@ -266,7 +264,7 @@ local function setup_autocommands(opts)
266264 callback = function ()
267265 if utils .is_nvim_tree_buf (0 ) then
268266 if vim .fn .getcwd () ~= core .get_cwd () or (opts .reload_on_bufenter and not opts .filesystem_watchers .enable ) then
269- reloaders .reload_explorer ()
267+ actions . reloaders .reload_explorer ()
270268 end
271269 end
272270 end ,
@@ -317,7 +315,7 @@ local function setup_autocommands(opts)
317315 callback = function ()
318316 utils .debounce (" Buf:modified" , opts .view .debounce_delay , function ()
319317 modified .reload ()
320- reloaders .reload_explorer ()
318+ actions . reloaders .reload_explorer ()
321319 end )
322320 end ,
323321 })
0 commit comments