Ok so first off, this is NOT the answer I'm looking for:
autocmd VimResized * :wincmd =
Let me explain: Let's assume I have 2 vertically split windows, one at 30% size and one at 70% size. When I resize my window, I want that percentage to stay the same. Without this command, the split on the right slowly collapses so that you eventually can't see anything in the window. With the command above, once you start resizing the window, the window sizes immediately change to 50%/50%.
I work with a lot of splits (vertical and horizontal) and I don't want the command above to just make everything equal, but at the same time I do want them to resize, just PROPORTIONALLY to the window... I want the percentage height/width of all splits in the window to stay the same when the window is resized. Ideas?
I've attempted to implement this in my ProportionalResize plugin, following basically the approach outlined in romainl's answer. You can wrap your resize commands in a :ProportionalResize
wrapper; the plugin also hooks into various events to allow automatic adaptation when the Vim window is resized e.g. with the mouse.
if you are asking a "vim - official" way to do that, answer is NO. (Vim 7.3)
to prove it:
open vim, type :h todo<Enter>
then type /proportionally[Enter]
you will see:
- When resizing the whole Vim window, the windows inside should be resized
proportionally (Webb).
so it is in vim's todo list. In this window type gg
, you can see the leading minus "-"
means Priority classification:
- unclassified
If you want to do it, you could write a function by yourself, on VimResized
event, resize all windows based on your logic.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With