File tree 1 file changed +17
-0
lines changed
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%" }
17
17
local floating_windows = {}
18
18
local draw , create_window , create_tree , render_tree
19
19
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
+
20
36
local resize_monitor_timer = nil
21
37
local start_resize_monitor = function ()
22
38
local interval = M .resize_timer_interval or - 1
@@ -813,6 +829,7 @@ create_window = function(state)
813
829
tabnr = state .tabnr ,
814
830
}
815
831
events .fire_event (events .NEO_TREE_WINDOW_BEFORE_OPEN , event_args )
832
+ clean_neotree_buffers ()
816
833
817
834
if state .current_position == " float" then
818
835
state .force_float = nil
You can’t perform that action at this time.
0 commit comments