Closed Emm54321 closed 2 days ago
I'm getting the same error with a slightly different use-case. This is the most minimal example I could come up with:
nvim
in any folder with subdirectories:tabnew
:tcd <some-subdirectory>
:Neotree toggle
:tabclose
The error only appears if the neotree pane has focus when the tab is closed. If the focus is on the empty pane, there's no error (i.e. Neotree show
instead of Neotree toggle
). A bit further digging revealed that the TabClosed autocmd is not triggered when the error appears, so the cleanup that comes with that won't happen, hence the error.
Neovim version: 0.9.5 Configuration:
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
end
vim.opt.rtp:prepend(lazypath)
-- require 'config.loadplugins'
require("lazy").setup({
{
'nvim-neo-tree/neo-tree.nvim',
branch = 'v3.x',
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons",
"MunifTanjim/nui.nvim"
},
},
})
I'm also being hit by this one.
For me, it's caused by a vim.cmd.bdelete
I was using in an autocmd TermClosed
when lazygit
term exited (to clear the buffer without the exit 0
msg), caused TabClose
event to not be fired (even though the tab is gone when the buffer is deleted).
The fix for me was to replace the bdelete
with vim.api.nvim_feedkeys(vim.keycode("<CR>"), "n", false)
, which also dismissed that message but allowed the TabClose
event to be fired and neo-tree state be cleared.
If you can't adjust your intended behavior like that, alternatively one can add the require("neo-tree.sources.manager").dispose_invalid_tabs()
near/after you deleted the buffer. This should also make sure neo-tree state (at least for this) remains consistent after a tab is closed even without the TabClose
event.
Did you check docs and existing issues?
Neovim Version (nvim -v)
v0.10.0-dev-679+gb60a2ab4c
Operating System / Version
debian sid
Describe the Bug
I get the following error after deleting a buffer in a tab from a TermClose autocmd when autochdir is set: [Neo-tree ERROR] Error in event handler for event vim_dir_changed[buffers.vim_dir_changed]: ...nvim/lazy/neo-tree.nvim/lua/neo-tree/sources/manager.lua:296: Invalid tabpage id: 2
Screenshots, Traceback
No response
Steps to Reproduce
Expected Behavior
No error, directory changed normally.
Your Configuration