File tree Expand file tree Collapse file tree 3 files changed +9
-2
lines changed Expand file tree Collapse file tree 3 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -358,7 +358,7 @@ local function setup_vim_commands()
358
358
command! NvimTreeClose lua require'nvim-tree'.close()
359
359
command! NvimTreeToggle lua require'nvim-tree'.toggle(false)
360
360
command! NvimTreeFocus lua require'nvim-tree'.focus()
361
- command! NvimTreeRefresh lua require'nvim-tree'.refresh( )
361
+ command! NvimTreeRefresh lua require'nvim-tree.lib'.refresh_tree(true )
362
362
command! NvimTreeClipboard lua require'nvim-tree'.print_clipboard()
363
363
command! NvimTreeFindFile lua require'nvim-tree'.find_file(true)
364
364
command! NvimTreeFindFileToggle lua require'nvim-tree'.toggle(true)
@@ -399,6 +399,7 @@ local function setup_autocommands(opts)
399
399
if opts .update_focused_file .enable then
400
400
vim .cmd " au BufEnter * lua require'nvim-tree'.find_file(false)"
401
401
end
402
+ vim .cmd " au BufUnload NvimTree lua require'nvim-tree.view'.View.tabpages = {}"
402
403
403
404
vim .cmd " augroup end"
404
405
end
Original file line number Diff line number Diff line change @@ -459,12 +459,15 @@ function M.open()
459
459
M .set_target_win ()
460
460
461
461
local cwd = vim .fn .getcwd ()
462
- view .open ()
462
+ local should_redraw = view .open ()
463
463
464
464
local respect_buf_cwd = vim .g .nvim_tree_respect_buf_cwd or 0
465
465
if respect_buf_cwd == 1 and cwd ~= M .Tree .cwd then
466
466
M .change_dir (cwd )
467
467
end
468
+ if should_redraw then
469
+ M .redraw ()
470
+ end
468
471
end
469
472
470
473
function M .sibling (node , direction )
Original file line number Diff line number Diff line change @@ -302,7 +302,9 @@ local function is_buf_valid(bufnr)
302
302
end
303
303
304
304
function M .open (options )
305
+ local should_redraw = false
305
306
if not is_buf_valid (M .View .bufnr ) then
307
+ should_redraw = true
306
308
create_buffer ()
307
309
end
308
310
@@ -320,6 +322,7 @@ function M.open(options)
320
322
if not opts .focus_tree then
321
323
vim .cmd (" wincmd p" )
322
324
end
325
+ return should_redraw
323
326
end
324
327
325
328
local function get_existing_buffers ()
You can’t perform that action at this time.
0 commit comments