elihunter173/dirbuf.nvim

Pressing '-' on the root buffer shows error

andrewferrier opened this issue · 4 comments

If I open dirbuf to the root directory (for example, by using pressing - until I reach it), then press - again, I see this error:

E5108: Error executing lua ...e/nvim/site/pack/packer/start/dirbuf.nvim/lua/dirbuf.lua:121: 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:121: in function 'open'
        [string ":lua"]:1: in main chunk

Obviously from the root one cannot go up, so it's arguably the right thing to do to show a warning, but it might be slightly more elegant to show an error specifically for that purpose. I'm not sure about everyone else, but I often just tend to mash the - key a few times, and it's easy to hit the root accidentally, at which point this error is a bit ugly.

Definitely not a high priority issue :)

FWIW, I have reproduced this with an almost completely minimal config (just packer and dirbuf), so I'm pretty sure it's not any of my other plugins causing it.

Yes I encountered this issue as well so it is a dirbuf bug. I'm currently working on fixing it in the no-dup-buffer branch. No fix right now but I'm hopeful I can fix it soon

Cool. I don't think it's critical but more of a 'spit and polish' bug.

Should be fixed now. I reworked the way :Dirbuf works so now it no longer errors on opening duplicate buffers. Also the cursor placement behavior should be more consistent now

Yep, that seems to work well - thanks!