E5108: Error executing lua .../dirbuf.nvim/lua/dirbuf.lua:22: Invalid buffer id: 7
stephane-klein opened this issue · 8 comments
Hello,
I'm on nvim 0.6.1
.
I have this error when I execute :Dirbuf
:
E5108: Error executing lua ...e/nvim/site/pack/packer/start/dirbuf.nvim/lua/dirbuf.lua:22: Invalid buffer id: 7
stack traceback:
[C]: in function 'nvim_buf_get_name'
...e/nvim/site/pack/packer/start/dirbuf.nvim/lua/dirbuf.lua:22: in function 'fill_dirbuf'
...e/nvim/site/pack/packer/start/dirbuf.nvim/lua/dirbuf.lua:117: in function 'open'
[string ":lua"]:1: in main chunk
Best regards,
Stéphane
Hello! Do you have any other file manager plugins installed? And could you provide me your Neovim config so I can try to reproduce the issue?
Do you have any other file manager plugins installed?
@elihunter173 Yes, https://github.com/lambdalisue/fern.vim
And could you provide me your Neovim config so I can try to reproduce the issue?
Ok, I will send you that as soon as.
Hmmm... Just installing fern.vim doesn't seem to cause any issues nor does twiddling with any of its options, so that's likely a dead end. Which is good because I think dirbuf pairs quite well with a tree viewer like fern
In the meantime, I'll await your config
I may be able to shed some light on this. At least with my configuration, this happens consistently and reproducabily for me with the following recreation instructions:
- Open vim with
nvim ~/.ssh
(to open the directory usingdirbuf
). (doesn't work with all directories) - Press enter on one the files in there (e.g.
id_rsa.pub
) to open it. - Press
-
to go back to the~/.ssh
directory.
Observe the following error:
E5108: Error executing lua ...e/nvim/site/pack/packer/start/dirbuf.nvim/lua/dirbuf.lua:112: Vim:E95: Buffer with this name already exists
stack traceback:
[C]: in function 'nvim_buf_set_name'
...e/nvim/site/pack/packer/start/dirbuf.nvim/lua/dirbuf.lua:112: in function 'open'
[string ":lua"]:1: in main chunk
@elihunter173 maybe this helps you recreate. If that doesn't help, let me know and I can try to minimize my configuration for you.
@andrewferrier Hmmm... I think that's a different issue because yours happens with nvim_buf_set_name
and trying to set a duplicate buffer name while stephane-klein's happens on nvim_buf_get_name
on a non-existent buffer.
That being said, I've actually seen your error before but never been able to reproduce it consistently. (Sadly I still can't even with your steps, but thank you!) However, I think I just figured out how to fix it so try updating to 7cdcd19. Your issue is caused by a bug in the code to re-open previously closed directory buffers. However, we can delete this code if we set bufhidden=wipe
since then we'll always recreate the directory buffer
@elihunter173 well spotted, sorry for not noticing the difference.
Confirmed I updated to the commit you mentioned and it has fixed the issue I was seeing above. So thanks, that's great!
@elihunter173 thanks, the bug is fixed on my computer 🙂
I don't know exactly what would have fixed the issue but that's good to hear!