VIM auto resize focused window

vim

Solution

The `'winheight'` setting determines the minimal number of lines for the current window. Some users set this to 999 for "Rolodex mode". The following sets this to 70%:

:let &winheight = &lines * 7 / 10

For anything fancier, you can hook into the `WinEnter` event via an `:autocmd`, and then set the window height to N via `:Nwincmd _`. Stupid example:

:autocmd WinEnter * execute winnr() * 2 . 'wincmd _'

Problem

I am slowly learning vim and its powerful capabilities. I have a question in regards to splitting windows (mainly horizontal splits). Is there a way to automatically resize the currently selected (focused) window? Let's say, for example, a setting so that the focused window will always take up 70% of the screen. Using Ctrl-w (number) +/- every time is not really efficient, especially when I am jumping between a few files constantly. Also it would be cool if there was a way to restrict it to only horizontally splitted windows.

Original source