:vsplit(缩写::vs)垂直分割Vim视口。:30vs分割视口,使新窗口宽30个字符。一旦创建了这个30字符的窗口,如何将其大小更改为31或29?

对于水平窗口,Ctrl-W +增加一行数。将列加1的等效命令是什么?


当前回答

CTRL-W >

and

CTRL-W <

使窗户变宽或变窄。

其他回答

我把这些映射到我的.gvimrc中,让我点击command-[arrow]来移动当前窗口的高度和宽度:

" resize current buffer by +/- 5 
nnoremap <D-left> :vertical resize -5<cr>
nnoremap <D-down> :resize +5<cr>
nnoremap <D-up> :resize -5<cr>
nnoremap <D-right> :vertical resize +5<cr>

对于MacVim,你必须把它们放在你的。gvimrc(而不是。vimrc)中,否则它们会被系统的。gvimrc覆盖

我正在使用以下命令:

set lines=50     " For increasing the height to 50 lines (vertical)
set columns=200  " For increasing the width to 200 columns (horizontal)

我使用数字通过在.vimrc中映射以下内容来调整大小

nmap 7 :res +2<CR> " increase pane by 2 
nmap 8 :res -2<CR> " decrease pane by 2
nmap 9 :vertical res +2<CR> " vertical increase pane by 2
nmap 0 :vertical res -2<CR> " vertical decrease pane by 2

ctrl - w =

会使它们相等

这是我现在使用的:

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