简体   繁体   English

(Vim键映射)可以在Vim中映射'<'或'>'吗?

[英](Vim key mapping) Is that possible to map '<' or '>' in Vim?

I want to add such key mapping like: 我想添加这样的键映射:

nmap <C->> <C-W>+
nmap <C-<> <C-W>-

but it seems doesn't work. 但似乎不起作用。 Is there any problem with the syntax? 语法有问题吗? I'm wondering that the '>' or '<' could be used just like the normal characters. 我想知道'>'或'<'是否可以像普通字符一样使用。

It has nothing to do with the syntax, but with one of the following: 它与语法无关,但与以下其中一项:

  1. Terminal may send <C-<> as just < . 终端可以像<一样发送<C-<>
  2. If there is a way to get <C-<> from a terminal, vim does not know about it. 如果有办法从终端获取<C-<> ,vim对此一无所知。
  3. If you are in GUI the representation of <C- combos cannot possibly handle <C-<> because the only keys it knows are from <C-@> (ctrl+0x40) to <C-_> (ctrl+0x5F) because only these combos can be possibly translated to the ASCII control characters (ones with 0x00—0x1F codes). 如果在GUI中, <C-组合的表示形式可能无法处理<C-<>因为它知道的唯一键是从<C-@> (ctrl + 0x40)到<C-_> (ctrl + 0x5F),因为只有这些组合才能转换为ASCII控制字符(带有0x00-0x1F代码的组合)。 < and > both fall out of this range. <>均不在此范围内。

And addition: use nnoremap , not nmap . 另外:使用nnoremap ,而不是nmap You don't need remapping here. 您无需在此处重新映射。

Due to the way that the keyboard input is handled internally, this unfortunately isn't possible today, even in GVIM. 由于内部处理键盘输入的方式,即使在GVIM中,今天也无法实现这一点。 This is a known pain point, and the subject of various discussions on vim_dev and the #vim IRC channel. 这是一个已知的痛点,也是有关vim_dev和#vim IRC通道的各种讨论的主题。

Some people (foremost Paul LeoNerd Evans) want to fix that (even for console Vim in terminals that support this), and have floated various proposals, cp. 有些人(最重要的是Paul LeoNerd Evans)想解决这个问题(甚至对于支持此功能的终端机中的控制台Vim),并提出了各种建议cp。 http://groups.google.com/group/vim_dev/browse_thread/thread/626e83fa4588b32a/bfbcb22f37a8a1f8 http://groups.google.com/group/vim_dev/browse_thread/thread/626e83fa4588b32a/bfbcb22f37a8a1f8

But as of today, no patches or volunteers have yet come forward, though many have expressed a desire to have this in a future Vim 8 major release. 但是到目前为止,还没有补丁或志愿者出现,尽管许多人表示希望在将来的Vim 8主要发行版中使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM