加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

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

发布时间:2020-12-15 18:23:58 所属栏目:安全 来源:网络整理
导读:我在VIM中虔诚地使用水平和垂直窗口分割,直到最近,我喜欢两个命令的舒适度来有效地隐藏(或最小化)我的水平分割.我设置它们将以下行添加到我的. vimrc文件中: set winminheight=0map C-J C-WjC-W_map C-K C-WkC-W_ 点击Control-j或Control-k通过向上或向下导
我在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.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读