Wikia

Vim Tips Wiki

Resize splits more quickly

Talk0
1,610pages on
this wiki
Revision as of 15:17, November 20, 2012 by Chrisbra (Talk | contribs)

Tip 1215 Printable Monobook Previous Next

created April 26, 2006 · complexity basic · author Robert · version 6.0


This tip is about how to resize Windows efficiently.

You can use Ctrl-W + and Ctrl-W - to resize a split window. For changing the width of a window, use Ctrl-W > to increase the window size by one, while Ctrl-W < decreases the window width by one. Those keys also accept a count, so that you can change the window size in larger steps, e.g. 10 Ctrl-W+ increases the window size by 10 lines. To resize all Windows to the same size, you can use CTRL-W = and to increase a window to its maximum size, use Ctrl-W _.

To resize in different steps, you can create maps that will adjust the window size differently. For example to increase the window size by a factor of 1.5 and decrease the window size by 0.67, you can map this:

nnoremap <silent> <Leader>+ :exe "resize " . (winheight(0) * 3/2)<CR>
nnoremap <silent> <Leader>- :exe "resize " . (winheight(0) * 2/3)<CR>

Alternatively you can use the :resize command to change the height of the window, to change the window width, use the :vertical modifier. So to resize by 10 lines, use:

:res +10
:res -10

And to resize to a size of 20 use this:

:res 20
:vertical resize 20

It is also possible to use the mouse to resize a window. Simply grab the statusline at the window border and drag it into the desired direction.

See also

Plugins

The following plugins allow to define submodes, that make it possible to use e.g. Ctrl-W + to increase the window size and keep on increasing as long as you keep '+' pressed:

Comments

Around Wikia's network

Random Wiki