How can I split view all buffers in vim with a distribution between vertical and horizontal? Is there a plugin?

I know how to make all buffers appear in either horizontal or vertical splits:

:vertical ball

But I want several to be vertical first, then, once a reasonable number have displayed, start creating a 2nd row below it: so a horizontal split. Then, continue the process so we end with tiled windows. Maybe if there are 7 buffers:

|| x | x | x ||
|| x | x | x ||
||     x     ||

Use Case

Let's say I want to use bufdo on all my buffers. I'd like to see the changes they are making as much as feasible. Even on a small screen, I could make 4 vertical splits above 4 horizontal ones, and see a little bit of each file. More than 9 buffers, and it's probably too small to read, so maybe there could be a vimrc-changeable setting for user preference of max number of splits, and/or perhaps some influence based on screen resolution or display width ability.

Beginning of an answer

Based on the answer here, I'm tempted start macro'ing that, and I can see that temptation turning into writing my first plugin. I just feel like surely this is a common enough desire to already have an existing plugin or solution.

  • The question is not clear to me- what kind of layout are you trying to achieve? What do you man by "equal distribution vertical horizontal?"
    – Mass
    Commented Apr 24, 2022 at 15:48
  • Updated question for clarity. Apologies, I'm still not sure if it's clear, lmk.
    – Polo
    Commented Apr 24, 2022 at 16:13
  • Interesting question. You might be able to "watch" the changes if you disable lazyredraw; otherwise I recommend investigating them with another tool, like git diff or :help DiffOrig
    – D. Ben Knoble
    Commented Apr 26, 2022 at 13:34


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.