如何取消映射 TAB 并在 VIM 中不使 Ctrl-I 无效 [英] How to unmap TAB and do not make Ctrl-I invalid in VIM

查看:40
本文介绍了如何取消映射 TAB 并在 VIM 中不使 Ctrl-I 无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在普通模式下使用vim时,我经常不小心按下TAB键,默认情况下,TAB键的作用与Ctrl-I相同.我想让键 TAB 什么都不做,所以我把这一行放在 vimrc 文件中:

When I use vim in normal mode, I often press the TAB key accidentally, the key TAB do the same thing as Ctrl-I in default. I want to make the key TAB do nothing, so I put this line in the vimrc file:

nmap <TAB> :echo<CR> 

因此,键 TAB 什么也不做,但这使得键 Ctrl-I 也什么都不做.那么,如何让 TAB 不做任何事情而 Ctrl-I 像以前一样在 vim 中工作(在正常模式下)?

Thus, the key TAB will do nothing, but this made the key Ctrl-I do nothing too. So, how to make the TAB do nothing and the Ctrl-I work well as before in vim (in normal mode) ?

推荐答案

由于键盘输入是在内部处理的方式,不幸的是,这在今天通常是不可能的,即使在 GVIM 中也是如此.某些组合键,例如 Ctrl + non-alphabetic 无法映射,以及 Ctrl + letter>Ctrl + Shift + letter 无法区分.(除非您的终端为它发送了一个独特的 termcap 代码,而大多数不会.)这也适用于 /;, / 等等.这是一个已知的痛点,也是关于 vim_dev 和#vim IRC 频道.

Due to the way that the keyboard input is handled internally, this unfortunately isn't generally possible today, even in GVIM. Some key combinations, like Ctrl + non-alphabetic cannot be mapped, and Ctrl + letter vs. Ctrl + Shift + letter cannot be distinguished. (Unless your terminal sends a distinct termcap code for it, which most don't.) This also applies to <Tab> / <C-I>, <CR> / <C-M> etc. This is a known pain point, and the subject of various discussions on vim_dev and the #vim IRC channel.

有些人(最重要的是 Paul LeoNerd Evans)想要解决这个问题(即使是支持这个的终端中的控制台 Vim),并且已经浮动 各种提案.

Some people (foremost Paul LeoNerd Evans) want to fix that (even for console Vim in terminals that support this), and have floated various proposals.

但截至今天,还没有补丁或志愿者出现,尽管许多人表示希望在未来的 Vim 8 主要版本中拥有它.

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.

这篇关于如何取消映射 TAB 并在 VIM 中不使 Ctrl-I 无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆