调整vi多窗口的大小

This tip is about how to resize Windows efficiently.

You can use the :resize command or its shortcut :res to change the height of the window. To change the height to 60 rows, use:

:resize 60

You can also change the height in increments. To change the height by increments of 5, use:

:res +5
:res -5


You can use :vertical resize to change the width of the current window. To change the width to 80 columns, use:

:vertical resize 80

You can also change the width in increments. To change the width by increments of 5, use:

:vertical resize +5
:vertical resize -5


For a split window: You can use Ctrl-w + and Ctrl-w - to resize the height of the current window by a single row. For a vsplit window: You can use Ctrl-w > and Ctrl-w < to resize the width of the current window by a single column. Additionally, these key combinations accept a count prefix 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 equal dimensions based on their splits, you can use Ctrl-w =.

To increase a window to its maximum height, use Ctrl-w _.

To increase a window to its maximum width, 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>


In Gvim and vim in terminals with mouse support, 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.






转载于:https://www.cnblogs.com/iathena/p/82b2fd46f1579a14ba793d0f369366cc.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值