Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lua/neo-tree/defaults.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ local config = {
"git_status",
},
add_blank_line_at_top = false, -- Add a blank line at the top of the tree.
auto_clean_after_session_restore = false, -- Automatically clean up broken neo-tree buffers saved in sessions
close_if_last_window = false, -- Close Neo-tree if it is the last window left in the tab
-- popup_border_style is for input and confirmation dialogs.
-- Configurtaion of floating window is done in the individual source sections.
Expand Down
17 changes: 10 additions & 7 deletions lua/neo-tree/setup/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,6 @@ local define_events = function()
require("neo-tree.ui.renderer").update_floating_window_layouts()
end,
})

events.subscribe({
event = events.VIM_AFTER_SESSION_LOAD,
handler = function()
require("neo-tree.ui.renderer").clean_invalid_neotree_buffers(true)
end,
})
end

local prior_window_options = {}
Expand Down Expand Up @@ -626,6 +619,16 @@ M.merge_config = function(user_config, is_auto_config)
manager.redraw(source_name)
end

if M.config.auto_clean_after_session_restore then
require("neo-tree.ui.renderer").clean_invalid_neotree_buffers(false)
events.subscribe({
event = events.VIM_AFTER_SESSION_LOAD,
handler = function()
require("neo-tree.ui.renderer").clean_invalid_neotree_buffers(true)
end,
})
end

events.subscribe({
event = events.VIM_COLORSCHEME,
handler = highlights.setup,
Expand Down
1 change: 0 additions & 1 deletion lua/neo-tree/ui/renderer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,6 @@ create_window = function(state)
tabnr = state.tabnr,
}
events.fire_event(events.NEO_TREE_WINDOW_BEFORE_OPEN, event_args)
M.clean_invalid_neotree_buffers(false)

if state.current_position == "float" then
state.force_float = nil
Expand Down