如何增加 Vim 中垂直分割窗口的大小

发布于 2024-10-05 23:12:59 字数 216 浏览 5 评论 0原文

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

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

:vsplit (short form: :vs) split the Vim viewport vertically. :30vs splits the viewport, making the new window 30 characters wide. Once this 30 char window is created, how would one change it's size to 31 or 29?

With horizontal windows Ctrl-W + increases the number of lines by one. What is the equivalent command to increase the columns by one?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(10

绝不服输 2024-10-12 23:12:59

CTRL-W >

CTRL-W << /kbd>

使窗口变宽或变窄。

CTRL-W >

and

CTRL-W <

to make the window wider or narrower.

心清如水 2024-10-12 23:12:59

并且 Ctr-W =

将使它们相等

And Ctr-W =

will make them equal

噩梦成真你也成魔 2024-10-12 23:12:59

如果您还需要水平分割调整大小:
该命令对于所有拆分都是相同的,只是参数发生变化:

- + 而不是 < ; >

示例
减少水平尺寸 10 列

:10winc -

增加水平尺寸 30 列

:30winc +

或在正常模式下:

水平分割

10 CTRL+w -

30 CTRL+w +

垂直分割

10 CTRL+w <(减少)

30 CTRL +w >(增加)

In case you need HORIZONTAL SPLIT resize as well:
The command is the same for all splits, just the parameter changes:

- + instead of < >

Examples:
Decrease horizontal size by 10 columns

:10winc -

Increase horizontal size by 30 columns

:30winc +

or within normal mode:

Horizontal splits

10 CTRL+w -

30 CTRL+w +

Vertical splits

10 CTRL+w < (decrease)

30 CTRL+w > (increase)

风蛊 2024-10-12 23:12:59

我这边的另一个提示:

为了将窗口的宽度设置为 80 列,请使用

80 CTRL+W |

为了将其设置为最大宽度,只需省略前面的数字:

CTRL+W |

Another tip from my side:

In order to set the window's width to let's say exactly 80 columns, use

80 CTRL+W |

In order to set it to maximum width, just omit the preceding number:

CTRL+W |
吃兔兔 2024-10-12 23:12:59

我将这些映射到我的 .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

I have these mapped in my .gvimrc to let me hit command-[arrow] to move the height and width of my current window around:

" 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>

For MacVim, you have to put them in your .gvimrc (and not your .vimrc) as they'll otherwise get overwritten by the system .gvimrc

瀟灑尐姊 2024-10-12 23:12:59

同样,我在 .vimrc 中使用以下内容来让我在分割中移动,自动将我要移动到的分割扩展到其完整大小,并将所有其余部分缩小到最小高度或宽度:

" Switch between window splits using big J or K and expand the split to its 
" full size. 
" 
" Move vertically in the window through the horizontal splits... 
map <C-J> <C-w>j<C-w>_ 
map <C-K> <C-w>k<C-w>_ 

" Move horizontally in the window through the vertical splits... 
map <C-H> <C-w>h<C-w>\| 
map <C-L> <C-w>l<C-w>\| 

Along the same lines, I use the following in my .vimrc to let me move through the splits, automatically expanding the one I'm moving to to its full size and shrinking all the rest to their minimum height or width:

" Switch between window splits using big J or K and expand the split to its 
" full size. 
" 
" Move vertically in the window through the horizontal splits... 
map <C-J> <C-w>j<C-w>_ 
map <C-K> <C-w>k<C-w>_ 

" Move horizontally in the window through the vertical splits... 
map <C-H> <C-w>h<C-w>\| 
map <C-L> <C-w>l<C-w>\| 
菩提树下叶撕阳。 2024-10-12 23:12:59

这是我现在正在使用的:

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>

This is what I am using as of now:

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>
じ违心 2024-10-12 23:12:59

要更改宽度,请使用“垂直调整大小”,要更改高度,请使用“调整大小”。

我在 .vimrc 中完成了以下映射

  1. ALT 将增加所选分割的宽度

  2. ALT 将减小所选分割的宽度< /p>

  3. ALT 将增加所选分割的高度< /p>

  4. ALT 将降低所选拆分的高度< /p>

我的 .vimrc 代码:

nmap <M-Right> :vertical resize +1<CR>
nmap <M-Left> :vertical resize -1<CR>
nmap <M-Down> :resize +1<CR>
nmap <M-Up> :resize -1<CR>

Vim 更快地调整分割大小

For changing width use "vertical resize" and for changing height use "resize".

I have done following mapping in my .vimrc

  1. ALT will increase width of the selected split

  2. ALT will decrease width of the selected split

  3. ALT will increase height of the selected split

  4. ALT will decrease height of the selected split

My .vimrc code:

nmap <M-Right> :vertical resize +1<CR>
nmap <M-Left> :vertical resize -1<CR>
nmap <M-Down> :resize +1<CR>
nmap <M-Up> :resize -1<CR>

Vim Resize Splits more quickly

寂寞陪衬 2024-10-12 23:12:59

我通过在 .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

I am using numbers to resize by mapping the following in .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
萌无敌 2024-10-12 23:12:59

我为此使用以下命令:

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

I am using the below commands for this:

set lines=50     " For increasing the height to 50 lines (vertical)
set columns=200  " For increasing the width to 200 columns (horizontal)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文