Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature parity between make_tablist & make_buflist? #178

Open
lougreenwood opened this issue Dec 5, 2023 · 1 comment
Open

Feature parity between make_tablist & make_buflist? #178

lougreenwood opened this issue Dec 5, 2023 · 1 comment

Comments

@lougreenwood
Copy link

lougreenwood commented Dec 5, 2023

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?

@lougreenwood
Copy link
Author

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant