How do you increase or decrease the height or width of a vim buffer in a way so that when you hold down the key combo, the size constantly changes?
Try these:
:nmap ^[> :vertical res +1^M
:nmap ^[< :vertical res -1^M
To input the ^[
, press Ctrl-v then Esc. To input the ^M
, press Ctrl-v then Enter.
As suggested by Heptite in a comment, you can use key-notation instead of literal characters:
:nmap <Esc>> :vertical res +1<Enter>
:nmap <Esc>< :vertical res -1<Enter>
Results in the same mapping as the example at the top.
Now you can hold down Alt-Shift-> to smoothly increase the width or Alt-Shift-< to smoothly increase it. It feels kind of weird using it in the right-hand window to me, because I think that I'm moving the separator left and right, but that's not what's happening.
For changing the size of horizontally split windows:
:nmap ^[+ :res +1^M
:nmap ^[- :res -1^M
These are the regular plus and minus keys rather than the ones on the keypad. On my US keyboard, in addition to Alt, I hold Shift for +, but no Shift for -.
You can also use 10 ctrl-w <
or 10 ctrl-w >
to change it by 10 units.