I know how to resize a window (CTRL_W +
). But when I want to repeat the same command, .
is useless. Typing CTRL_W +
repeatedly is boring. Is there anything else I can do?
In my system:
if bufwinnr(1)
map + <C-W>+
map - <C-W>-
endif
does not work.
if bufwinnr(1)
map <kPlus> <C-W>+
map <kMinus> <C-W>-
map <kDivide> <c-w><
map <kMultiply> <c-w>>
endif
does work.
I'd recommend the mapping of +
and -
key like this (in your .vimrc
):
if bufwinnr(1)
map + <C-W>+
map - <C-W>-
endif
And please read this, there are several good tips: http://vim.wikia.com/wiki/Fast_window_resizing_with_plus/minus_keys
The Ctrl-W+ shortcut takes a preceding count. The Ctrl-W_ command maximizes the window without a count, or sets absolute height with a preceding count. Using counts, you should rarely have to do repeated window resizing commands.
If you do find yourself frequently wanting to make small repeated adjustments to window sizes, maybe you could take advantage of the repeatability of ex-commands (with @:
) and resize with :resize +1
instead of the keyboard shortcut. If you resize windows all the time, I'd go with mapping the + and - as Zsolt suggested. If you are just restoring the same window layout over and over, look into using a saved session file (:help sessions
).
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