File tree 1 file changed +8
-5
lines changed
1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -103,9 +103,10 @@ function M.on_enter(netrw_disabled)
103
103
local lines = not is_dir and api .nvim_buf_get_lines (bufnr , 0 , - 1 , false ) or {}
104
104
local buf_has_content = # lines > 1 or (# lines == 1 and lines [1 ] ~= " " )
105
105
106
- local should_open = _config .open_on_setup
107
- and ((is_dir and netrw_disabled ) or (bufname == " " and not buf_has_content ))
108
- and not vim .tbl_contains (ft_ignore , buftype )
106
+ local buf_is_dir = is_dir and netrw_disabled
107
+ local buf_is_empty = bufname == " " and not buf_has_content
108
+ local should_be_preserved = vim .tbl_contains (ft_ignore , buftype )
109
+ local should_open = _config .open_on_setup and not should_be_preserved and (buf_is_dir or buf_is_empty )
109
110
110
111
if should_open then
111
112
M .hijack_current_window ()
@@ -372,9 +373,11 @@ function M.setup(conf)
372
373
require ' nvim-tree.explorer' .setup (opts )
373
374
require ' nvim-tree.git' .setup (opts )
374
375
setup_vim_commands ()
375
- setup_autocommands (opts )
376
376
377
- M .on_enter (netrw_disabled )
377
+ vim .schedule (function ()
378
+ M .on_enter (netrw_disabled )
379
+ setup_autocommands (opts )
380
+ end )
378
381
end
379
382
380
383
return M
You can’t perform that action at this time.
0 commit comments