微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

“最小化”垂直VIM窗口分割

我在VIM中虔诚地使用水平和垂直窗口分割,直到最近,我喜欢两个命令的舒适度来有效地隐藏(或最小化)我的水平分割.我设置它们将以下行添加到我的. vimrc文件中:
set winminheight=0
map <C-J> <C-W>j<C-W>_
map <C-K> <C-W>k<C-W>_

点击Control-j或Control-k通过向上或向下导航水平分割.通过使用Control-Shift-h和Control-Shift-l显示或隐藏左或右分割,我想要完成的是垂直分割; h向左移动,向右移动.我尝试过以下几点但没有成功:

set winminwidth=0
map <S-C-L> 500<C-W>h<C-W>_
map <S-C-H> 500<C-W>l<C-W>_

该动作类似于利用Control-w-<和Control-w-&gt ;,只将垂直分割完全向左移动或写入,而不是一次只移动一行. 有关如何实现这一目标的任何想法?谢谢.

首先,您将无法在代码中使用< S-C-(移位控制)(见下文).但你可以使用'mapleader'作为你的“转变”,然后使用< C-h>和< C-1>就像你想要的那样.像这样:
set winminwidth=0
nmap <leader><C-h> <C-W>h500<C-W>>             
nmap <leader><C-l> <C-W>l500<C-W>>

vim中的常用leader键是逗号和反斜杠:

:let mapleader = ","

但是你会发现这对于要求3次击键很烦人,所以你不妨放下控制键击.这样(如果你的领导是逗号),你只需按“,h”和“,l”就可以左右分割:

set winminwidth=0
nmap <leader>h <C-W>h500<C-W>>             
nmap <leader>l <C-W>l500<C-W>>       

" (FTW) :D

一个名叫Tony Chapman answers的人为什么不能使用控制班次:

Vim maps its Ctrl+printable_key
combinations according to ASCII. This
means that “Ctrl+lowercase letter” is
the same as the corresponding
Ctrl+uppercase letter” and that
Ctrl+<key> (where <key> is a printable
key) is only defined when <key> is in
the range 0x40-0x5F,a lowercase
letter,or a question mark. It also
means that Ctrl-[ is the same as Esc,
Ctrl-M is the same as Enter,Ctrl-I is
the same as Tab.

So yes,Ctrl-s and Ctrl-S (i.e. Ctrl-s
and Ctrl-Shift-s) are the same to Vim. This is by design and is not going to change.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐