File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,22 @@ local default_popup_size = { width = 60, height = "80%" }
1717local floating_windows = {}
1818local draw , create_window , create_tree , render_tree
1919
20+ -- clean up neotree buffers created by :mksession
21+ local cleaned_up = false
22+ local clean_neotree_buffers = function ()
23+ if cleaned_up then
24+ return
25+ end
26+
27+ for _ , buf in ipairs (vim .api .nvim_list_bufs ()) do
28+ local bufname = vim .fn .bufname (buf )
29+ if string.match (bufname , " neo%-tree [^ ]+ %[%d+]" ) then
30+ vim .api .nvim_buf_delete (buf , { force = true })
31+ end
32+ end
33+ cleaned_up = true
34+ end
35+
2036local resize_monitor_timer = nil
2137local start_resize_monitor = function ()
2238 local interval = M .resize_timer_interval or - 1
@@ -813,6 +829,7 @@ create_window = function(state)
813829 tabnr = state .tabnr ,
814830 }
815831 events .fire_event (events .NEO_TREE_WINDOW_BEFORE_OPEN , event_args )
832+ clean_neotree_buffers ()
816833
817834 if state .current_position == " float" then
818835 state .force_float = nil
You can’t perform that action at this time.
0 commit comments