zefei / vim-wintabs

Modern buffer manager for Vim
MIT License
325 stars 25 forks source link

Render multiple tabs per window / split in tabline. #16

Closed jordwalke closed 6 years ago

jordwalke commented 7 years ago

I created this mock of what an ideal Wintabs renderer might look like. In this mock, the (awesome) existing feature of Wintabs rendering multiple tabs per window, is performed in the tabline. This allows the bottom statusline to be occupied by airline.

I might prefer a above, because there's an upcoming neovim feature called "tabat", which allows you to receive clicks at certain locations in the tabline. That would allow the tabs to be clickable! (And even handling the click on a little close button per tab perhaps). This would not be possible with the statusline approach for horizotal splits (b above) so it might make sense to just not even support it. To be clear, even with b, you could support horizontal splits, but it would be more like each vertical split may have several tabs, and within each of those tabs could exist many horizontal splits. (That would be the hierarchy of WinTabs windows - vertical splits contain many tabs, and each tab contains many horizontal splits).

Thoughts? Is there a better way to achieve this?

wintabsdreaming
zefei commented 7 years ago

I thought about this exactly like you proposed here when creating wintabs, but the work and edge cases (imagine vsplit inside hsplit) involved are just too much for me to see it worthwhile. My conclusion at the time was that a better way to do this is simply to patch neovim and suggest them to adopt per-window tabline as an option, I didn't follow through though. Swaping statusline and tabline isn't really a good option as statusline refreshes more frequently and imposes a significant performance hit on vim.

Regarding tabline click, I actually suggested that to neovim in the first place to make wintabs clickable. I'm still in the process of adapting wintabs to this feature because the current implementation neovim requires stuffing more invisible characters to tabline, which makes the layout calculation even harder.

jordwalke commented 7 years ago

Swaping statusline and tabline isn't really a good option as statusline refreshes more frequently and imposes a significant performance hit on vim

In my current setup, I currently already use the statusline to render wintabs (using the builtin feature). In my proposal, the main statusline at the bottom would usually contain airline, and it's the tabline that would contain wintabs.

In the common case, where we are replicating "modern editors", we would typically have several vertical splits, each with many tabs and no horizontal splits. In that case, it seems to suffice to render tabs in the tabline as the screenshot shows. What if, in the simplest, first iteration, everything was just limited to this narrow use case that replicates "modern editors". Then for supporting horizontal splits inside of each vertical tabs I can imagine a few solutions (you can let me know if it's not so simple).

zefei commented 7 years ago

The performance hit I talked about is mainly if you use tabline to show statusline stuff (like airline). Showing tabline stuff inside statusline is totally fine.

However, I'm still not convinced that using the single tabline for multiple windows is worth doing first. It indeed is useful, but to me I'd rather spend time on other things like clickable tabs, layout fixes, or patching (neo)vim directly.

jordwalke commented 7 years ago

I just don't see any other way to create a "modern" Vim experience. I mean, right now, even with WinTabs using the statusline, it is very much like a modern editor. The only thing is that people think it's kind of strange to have tabs on the bottom. Perhaps the better approach, is to have neovim allow custom placement of the statuslines (per window), and tabline. If that were possible you would merely need to put statuslines at the top of every window, and then place the tabline at the bottom of the entire screen (but right above the command input :), and render airline in that tabline.

zefei commented 6 years ago

Closing this as I think I won't go with this path. Thanks for the input. I might patch neovim directly for this issue if time permits.