rebelot/heirline.nvim

Feature parity between `make_tablist` & `make_buflist`?

Opened this issue · 1 comments

I use a custom implementation of tab components to build an heirline tabline which shows each tab.

The tab has a usual filename, icon, close button etc - these correspond to the currently active file in the tab.

My workflow is such that I group one or a small number of related buffers per tab, effectively I simulate the usual vim pattern of "a list of "buffer tabs" which represents the buffers in a given tab" instead as a "list of "tabpage tabs" which represent an individual tab page, where the file name associated with the tab corresponds to the currently active buffer in the tab".

However, because I must use make_tablist, it means that I don't have access to the left_trunc / right_trunc pagination arrows.

I'm willing to submit a PR which brings the make_tablist API closer to the current make_buflist (without breaking changes).

Would this PR be welcomed?

Just thinking more about this.

When I first wrote the issue my instinct to suggest generalise the make_buflist general and not couples to either tabs or buffers. Instead a more generic function would require a callback to get a list of items, another callback to pick values off the items etc.

With the above in mind, and reflecting on the following statement from the readme:

Heirline does not provide any defaults, in fact, heirline can be thought of as an API to generate Vim status format strings.

It seems that the existence of separate make_buflist and make_tablist and the lack of parity is an implicit default.

So, further to my comment above, id like to float the idea of a new make_itemlist which is generic and usable for both buffers & tabs (but also other lists or use cases which may arise in the future). The function would be generic and de-coupled from both buffer and tab lists and a set of complementary helper functions (used as callbacks) would be added to the public api to allow implementing the current make_buflist in user space as well as allow me to implement my improved make_tablist.

This make_itemlist would be intended as a replacement for make_buflist and make_tablist. make_buflist and make_tablist would then be deprecated for removal in the next major version release.

Thoughts?