@@ -87,7 +87,7 @@ function M.hijack_current_window()
87
87
vim .defer_fn (remove_empty_buffer , 100 )
88
88
end
89
89
90
- function M .on_enter (opts )
90
+ function M .on_enter (netrw_disabled )
91
91
local bufnr = api .nvim_get_current_buf ()
92
92
local bufname = api .nvim_buf_get_name (bufnr )
93
93
local buftype = api .nvim_buf_get_option (bufnr , ' filetype' )
@@ -100,8 +100,6 @@ function M.on_enter(opts)
100
100
cwd = vim .fn .expand (bufname )
101
101
end
102
102
103
- local netrw_disabled = opts .disable_netrw or opts .hijack_netrw
104
-
105
103
local lines = not is_dir and api .nvim_buf_get_lines (bufnr , 0 , - 1 , false ) or {}
106
104
local buf_has_content = # lines > 1 or (# lines == 1 and lines [1 ] ~= " " )
107
105
@@ -351,11 +349,13 @@ function M.setup(conf)
351
349
local opts = vim .tbl_deep_extend (' force' , DEFAULT_OPTS , conf or {})
352
350
353
351
manage_netrw (opts .disable_netrw , opts .hijack_netrw )
352
+ local netrw_disabled = opts .disable_netrw or opts .hijack_netrw
354
353
355
354
_config .update_focused_file = opts .update_focused_file
356
355
_config .open_on_setup = opts .open_on_setup
357
356
_config .ignore_ft_on_setup = opts .ignore_ft_on_setup
358
357
_config .update_to_buf_dir = opts .update_to_buf_dir
358
+ _config .update_to_buf_dir .enable = _config .update_to_buf_dir .enable and netrw_disabled
359
359
360
360
require ' nvim-tree.colors' .setup ()
361
361
require ' nvim-tree.actions' .setup (opts )
@@ -367,7 +367,7 @@ function M.setup(conf)
367
367
setup_autocommands (opts )
368
368
setup_vim_commands ()
369
369
370
- M .on_enter (opts )
370
+ M .on_enter (netrw_disabled )
371
371
end
372
372
373
373
return M
0 commit comments