elihunter173 / dirbuf.nvim

A file manager for Neovim which lets you edit your filesystem like you edit text
GNU Affero General Public License v3.0
423 stars 7 forks source link

E5108: Error executing lua .../dirbuf.nvim/lua/dirbuf.lua:22: Invalid buffer id: 7 #12

Closed stephane-klein closed 2 years ago

stephane-klein commented 2 years ago

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

elihunter173 commented 2 years ago

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?

stephane-klein commented 2 years ago

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.

elihunter173 commented 2 years ago

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

andrewferrier commented 2 years ago

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:

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.

elihunter173 commented 2 years ago

@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 7cdcd19324c93b90e7c2bf35e59680c174abac62. 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

andrewferrier-ibm commented 2 years ago

@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!

stephane-klein commented 2 years ago

@elihunter173 thanks, the bug is fixed on my computer :slightly_smiling_face:

elihunter173 commented 2 years ago

I don't know exactly what would have fixed the issue but that's good to hear!