bufferline.nvim
bufferline.nvim copied to clipboard
Feature Request - Don't treat opened files as conflicting unless they are in the same group
Let's say I have two groups defined, "A" and "B". I open files "a" and "b" which exist within the paths that define groups "A" and "B" respectively. Since they are in different groups, there's no need to show the full path to the file, I can already visually distinguish them from one another by the group they are in.
@rickyelopez tbh this is quite complex to implement. I'm not really a fan of adding this kind of complexity, but if you want to take a stab at it, I can point you in the right direction.
Yeah I'd appreciate some pointers! thanks!
@rickyelopez I can think of how to handle this, but I honestly am really not sure that this is really necessary. With each new feature request, this plugin gets more and more complex, with more and more options to handle different user preferences and edge cases. I really feel like currently my main object for this plugin is to try and prevent increasing complexity that one day just makes this too unpleasant and convoluted to maintain.
The solution to this would probably be that rather than calculating duplicates based on the list of all buffers, it is calculated only based on the groups of buffers. The problem with this is that duplicates are calculated much earlier than groups as groups are only added afterwards, so you'd need to either move group calculation higher or delay calculating duplicated till later in either case that will be quite complex as you will see since once the buffers are drawn it's hard to add changes to them based on things that happen afterwards.
I hope based on this brief explanation, you might start to see some of the complexity involved. I'm happy to look over a PR that can somehow accomplish this with minimal increased complexity, but I personally am fully not convinced of the cost benefit ratio of this feature.
Hmmm yeah that doesn't sound ideal. Maybe you have ideas for an alternative way to solve my problem? Really the issue for me is that the tab names become so long as soon as there is a duplicate, even if the majority of the path is the same except for (for example) the name of a parent folder three levels up. Is there something else we can do that would make it shorter for duplicated tabs, especially when most of the path is the same?
I guess making the duplication somewhat configurable would be a good approach, e.g. it could be something that has an option to say render only the first letter of the dirs e.g. f/b/c/duplicate.lua | d/b/c/duplicate.lua or an option to show like ellipses in between the dirs e.g. f/..../duplicate.lua | d/.../duplicate.lua 🤷🏿♂️. That would be easier to implement
https://github.com/akinsho/bufferline.nvim/blob/main/lua/bufferline/duplicates.lua#L89-L83
The function here could be turned into something configurable, so for example it could take a string enum of like config.deduplication_style = 'directory_name' | 'ellipses' | 'truncated' which map to different functions that handle the truncation differently.
Yeah both of those options sound pretty good to me. Is this something you'd be willing to add?
@rickyelopez I personally won't add this anytime soon if at all, this isn't really something I need for my workflow or something many other people have requested, so there's no urgency as far as I'm concerned. If you would like to look into submitting a PR, I can point you to where you need to look
Ok maybe I'll take a stab at it then
Gonna close this out now, I'm definitely still fine to have it contributed but as it's been a while without movement I'd rather not just have this here interminably. If someone wants to raise a PR please open an issue referencing this to discuss or feel free to try implementing it and pinging me.
No worries. I don't have the time right now, but maybe some day.