vim多窗口操作shortcut

本文介绍了如何使用Vim快捷键调整窗口大小,包括使所有窗口等宽等高、单独调整窗口大小、垂直或水平方向调整等功能,以及如何通过命令行设置窗口最小高度和宽度。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

6. Window resizing					*window-resize*


						*CTRL-W_=*
CTRL-W =	Make all windows (almost) equally high and wide, but use
		'winheight' and 'winwidth' for the current window.
		Windows with 'winfixheight' set keep their height and windows
		with 'winfixwidth' set keep their width.


:res[ize] -N					*:res* *:resize* *CTRL-W_-*
CTRL-W -	Decrease current window height by N (default 1).
		If used after 'vertical': decrease width by N.


:res[ize] +N					*CTRL-W_+*
CTRL-W +	Increase current window height by N (default 1).
		If used after 'vertical': increase width by N.

:res[ize] [N]

CTRL-W CTRL-_					*CTRL-W_CTRL-_* *CTRL-W__*
CTRL-W _	Set current window height to N (default: highest possible).

z{nr}<CR>	Set current window height to {nr}.


						*CTRL-W_<*
CTRL-W <	Decrease current window width by N (default 1).


						*CTRL-W_>*
CTRL-W >	Increase current window width by N (default 1).


:vertical res[ize] [N]			*:vertical-resize* *CTRL-W_bar*
CTRL-W |	Set current window width to N (default: widest possible).

You can also resize a window by dragging a status line up or down with the
mouse.  Or by dragging a vertical separator line left or right.  This only
works if the version of Vim that is being used supports the mouse and the
'mouse' option has been set to enable it.

The option 'winheight' ('wh') is used to set the minimal window height of the
current window.  This option is used each time another window becomes the
current window.  If the option is '0', it is disabled.  Set 'winheight' to a
very large value, e.g., '9999', to make the current window always fill all
available space.  Set it to a reasonable value, e.g., '10', to make editing in
the current window comfortable.

The equivalent 'winwidth' ('wiw') option is used to set the minimal width of
the current window.

When the option 'equalalways' ('ea') is set, all the windows are automatically
made the same size after splitting or closing a window.  If you don't set this
option, splitting a window will reduce the size of the current window and
leave the other windows the same.  When closing a window, the extra lines are
given to the window above it.

The 'eadirection' option limits the direction in which the 'equalalways'
option is applied.  The default "both" resizes in both directions.  When the
value is "ver" only the heights of windows are equalized.  Use this when you
have manually resized a vertically split window and want to keep this width.
Likewise, "hor" causes only the widths of windows to be equalized.

The option 'cmdheight' ('ch') is used to set the height of the command-line.
If you are annoyed by the |hit-enter| prompt for long messages, set this
option to 2 or 3.

If there is only one window, resizing that window will also change the command
line height.  If there are several windows, resizing the current window will
also change the height of the window below it (and sometimes the window above
it).

The minimal height and width of a window is set with 'winminheight' and
'winminwidth'.  These are hard values, a window will never become smaller.

==============================================================================
**
CTRL-W = 使得所有窗口 (几乎) 等宽、等高,但当前窗口使用 'winheight' 和
'winwidth'。

:res[ize] -N ** ** **
CTRL-W - 使得当前窗口高度减 N (默认值是 1)。
如果在 'vertical' 之后使用,则使得宽度减 N。

:res[ize] +N **
CTRL-W + 使得当前窗口高度加 N (默认值是 1)。
如果在 'vertical' 之后使用,则使得宽度加 N。

:res[ize] [N]
CTRL-W CTRL-_ ** **
CTRL-W _ 设置当前窗口的高度为 N (默认值为最大可能高度)。

z{nr}<CR> 设置当前窗口的高度为 {nr}

**
CTRL-W < 使得当前窗口宽度减 N (默认值是 1)。

**
CTRL-W > 使得当前窗口宽度加 N (默认值是 1)。

:vertical res[ize] [N] ** **
CTRL-W | 设置当前窗口的宽度为 N (默认值为最大可能宽度)。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值