Resizing Vim Window Splits Like a Boss
If you’re using Vim as your text editor (if you’re not, these videos will convince you), you’re probably using window splits.
If you’re using window splits, you probably wished you had a quick way to resize them.
I recently watched Gary Bernhardt’s video on VIM File Navigation, and got inspired to research this problem.
So, set the following in your ~/.vimrc:
1 2 |
|
This will make sure all splits will be at least 5 lines (which is enough for reference), and the current window will be 30 lines. As you navigate through the windows, the current one will become 30 lines.
You can increase or decrease the size of a window by one line with Ctrl-w + - and Ctrl-w + +.
That probably makes no sense. So you should use + and - to increase or decrease windows by a sane amount:
1 2 |
|
As for navigation, I’m using these mappings to move between splits with Ctrl-w + - and Ctrl-w + *+:
1 2 3 4 |
|
Also, if you want to make all windows equal, use Ctrl-w + =
Check this out for similar nuggets.