ap / vim-buftabline

Forget Vim tabs – now you can have buffer tabs
http://www.vim.org/scripts/script.php?script_id=5057
MIT License
782 stars 75 forks source link

Feature Request: show active buffer in vertical splits #24

Closed gibfahn closed 6 years ago

gibfahn commented 7 years ago

For vertical splits it would be great if the split on the right could have its currently open buffer shown above it (as in the picture below).

screen shot 2016-10-08 at 11 03 25
ap commented 7 years ago

Glad you like it enough to suggest an improvement. 😊

That looks nice, so if you have a concrete idea for how to implement this, I’m interested.

Like, what is it supposed to do with (say) 30 files rather than just 3? Where do the inactive tabs go – all on one side? If yes, does this mean opening a vertical split cuts the available space in the tabline in half? Or is the rest of the tabline supposed to flow “under” the active tabs? Or, do you envision the plugin tracking which window the tabs were shown in last? But then what if you have the same buffer open in multiple windows? And if you sometimes look at a buffer in one window and sometimes in the other, does the tab jump from side to side?

Also, how does this scale to any layout besides two windows in a vertical split? If opening one vertical split halves the tabline, does opening more of them slice it into ever smaller pieces? Does it simply completely ignore the windows below the topmost horizontal split? Then what does it show if one of these windows is active?

How does all this intersect with the <Plug> mappings?

The screenshot covers the one easy, obvious case. I’m not interested in limiting the plugin to just that case – simply because my own use of Vim is not limited to it – so the other scenarios need solutions before I can consider this design. And I’ll confess to not feeling pressed to figure out the answers myself, because I am content with the way it handles splits right now. 😊

However – I am sincerely curious to hear about concrete ideas for how this design could scale. Maybe I’ll actually like such a proposal better than what I have now.

gibfahn commented 7 years ago

I can't imagine going back to the old vim -p style. I've got nnoremap <Tab> :bn<CR> and nnoremap <S-Tab> :bp<CR> and it works like a charm.

So as I understand it once you have more tabs open than can fit on the screen, you get a horizontally scrolling list of tabs, with your currently open buffer highlighted and any buffers open in other splits less highlighted. I don't think you'd want to start halving the tabline for each split, otherwise you'd end up not being able to see any of the other tabs. Therefore the other tabs would have to flow under the active tabs.

image

Thinking about it more, I guess you already know the filenames you have open because of the statusline at the bottom of each window, so having this would be duplicating information. However when you're changing buffers frequently, it's hard to keep track of which buffer is open in which tab, so I do think it'd be worth having.

I think what I'd find most useful would be for the tabline to be as it is currently, but for the buffer currently open in each split to be positioned at the top left of that split. There would be two ways of handling this, one would be to split the flow of the tabline around the raised tab, and the other would be to have a small gap before the raised tab. The latter would make it more obvious that the buffer name corresponds to the split.

For the plug mappings, I assume you mean this? I didn't actually know they existed, but assuming that they're just functions that skip n tabs, I don't think they'd be affected.

For horizontal splits, I'm not sure that there's much that could be done. Can you get a second tabline? Even if you could, I'm not sure you'd want to.

I'm not saying this is definitely a good idea, but I'm happy to think about it more. What other issues do you forsee?

gibfahn commented 6 years ago

I have since changed my theme, and I'm no longer finding this an issue at all.

image

I also spent some time trying to implement this while handling all the different edge-cases, and I didn't come up with anything that worked reliably.

Thanks for discussing it though!