Tuesday, August 5, 2008

Window Manipulation

If you have two horizontally split windows and would like to increase the size of the current window, you can do ctrl-w +. A count can be issued beforehand, so to increase the height by 10 lines 10 ctrl-w +. Ctrl-w - will decrease the current window height. To set the current window to an absolute height do N ctrl-w _ where N is the number of lines desired.

In a vertically split scheme, you can use ctrl-w < and ctrl-w > to adjust the width. To set the current window to an absolute width, do N ctrl-w | where N is the number of lines desired.

If you have two windows split horizontally and would like to shift to a vertical scheme, you can do ctrl-w H or ctrl-w L depending on which direction you want the current window to go. Ctrl-w J and ctrl-w K will take a vertically split scheme to a horizontal orientation.

4 comments:

Dr Foobario said...

I always use the mouse for window resizing, i.e. click the window border and drag.

This can be done (even over ssh) if you have :set mouse=a and :set term=[the appropriate setting]

Travis Whitton said...

I've done this in the past as well, but it seems to interfere with the highlight to copy mechanism in X windows. Does anybody know a way around that problem (aside from a hotkey to toggle mouse=a on and off)?

Anonymous said...

travis wrote:

> I've done this in the past as well,
> but it seems to interfere with the
> highlight to copy mechanism in X
> windows. Does anybody know a way
> around that problem (aside from a
> hotkey to toggle mouse=a on and off)?

When using "set mouse=a", try selecting with shift + mouse. It then uses the X selection mechanism instead of the Vim selection.

See ":help mouse".

Unknown said...

@Scrooloose
Thx for sharing, I could scrolling successfully, in vim but resizing window was just failed... event I :set term=[the appropriate setting],
maybe I don't set this value correctly, I try all these value @@