[英]What mapping should I add to my .vimrc that will allow me to split a buffer/window vertically/horizontally in VIM?
I just want to be able to split my VIM buffers/windows vertically and/or horizontally with a keyboard shortcut. 我只希望能够使用键盘快捷键在垂直和/或水平方向拆分VIM缓冲区/窗口。 I would like to use the following shortcuts:
我想使用以下快捷方式:
Vertical split 垂直分割
,v
Horizontal split 水平分割
,h
That would be a , (comma) followed by a v to vertically split a buffer & , (comma) followed by a h to horizontally split a buffer. 这将是一个, (逗号),后跟一个v以垂直拆分缓冲区& , (逗号)后跟一个h以水平拆分缓冲区。
You could try to learn directly the commands 您可以尝试直接学习命令
<C-w>s
<C-w>v
for the horizontal and vertical splits. 用于水平和垂直拆分。 I use the mapping
我使用映射
nnoremap ,w <C-w>
for <Cw>
so for the splits I type ,ws
or ,wv
对于
<Cw>
因此对于拆分,我键入,ws
或,wv
The advantage of this is that it allows you to use ,w
for all the other mappings provided by <Cw>
这样做的好处是,它允许您对
<Cw>
提供的所有其他映射使用,w
One last mapping I find useful in this context is 我发现在这种情况下有用的最后一个映射是
nnoremap ,, <C-w><C-w>
for changing between the various splits. 用于在各个拆分之间进行切换。
nnoremap ,v <C-w>v
nnoremap ,h <C-w>s
nnoremap ,v :split<enter>
nnoremap ,h :vsplit<enter>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.