barbar.nvim
barbar.nvim copied to clipboard
This is a borderline "bug" in how the tabs maintain the buffer sequence
First and foremost, Thank you! for this aesthetically pleasing, and productive neovim plugin using lua.
Background
I am a longtime user of vim, then neovim (about 8 years ago now). I give you this context because there is a norm that I clearly have become dependent on in how the buffer sequencing is maintained following deletions and additions of new buffers.
IMO
I might put forward that when a plugin interacts/overlaps with the builtin neovim functionality, that the design should align with it when possible and makes sense.
Case in point
The sequence that barbar presents the tabs is not aligned with the builtin :bn and :bp commands.
A fresh neovim session - all good. However, delete and add new buffers over time, the behavior diverges from a norm. The behavior exists with restored sessions so is difficult to "clear away".
Finally, I do have the <leader>1 ... up and running. Previous generations of plugins with this functionality did so while maintaining the alignment of the tab sequence with the :bp, :bn commands.
Thank you again. I hope this helps!
As you've noticed barbar.nvim's buffer order does not reflect that of the internal Vim buffer list. This is so that we can offer features (e.g. reordering buffers) & customization (e.g. insertion position) that aren't possible with the built-in options.
However, we do offer :BufferNext and :BufferPrevious which navigate like :bn & :bp, with the addendum that it works as expected given barbar.nvim's buffer layout. Do these commands address this issue?
You have a tough job managing everyone's experience and preference (e.g., I saw a request to order buffers by frequency of use!, no bueno in my book). How about enabling a register (config option) whereby barbar will maintain the sequence to be consistent with :bn and :bp?
We just had another related issue come up which gave me an idea about how we could likely solve this: if you change the snippet from that issue comment to use BufferOrderByBufferNumber it might do what you're looking for.
Closing for now as BufferOrderByBufferNumber should achieve the desired behavior. If not, feel free to reopen!