简体   繁体   English

如何禁用 vim 中的所有键映射?

[英]How do you disable all key mappings in vim?

The effect that I would like is to remove all key mappings/bindings from vim such that I can then only specify the bindings I use and build from there.我想要的效果是从 vim 中删除所有键映射/绑定,这样我就只能指定我使用并从那里构建的绑定。

What is the best way to disable everything so that I can configure a whitelist of my own?禁用所有内容以便我可以配置自己的白名单的最佳方法是什么?

The only way to do what you want is to map every built-in command to :help <Nop> in all relevant modes:做你想做的唯一方法是 map每个内置命令:help <Nop>在所有相关模式下:

nnoremap a <Nop>
xnoremap a <Nop>
...

and then to create your own custom mappings:然后创建您自己的自定义映射:

nnnoremap a <do something>

Note that Vim's commands are not implemented as mappings.请注意,Vim 的命令不是作为映射实现的。 The above overrides every key combination with a new empty mapping, essentially disabling it, and then creates your own custom mappings.以上使用新的空映射覆盖每个键组合,基本上禁用它,然后创建您自己的自定义映射。

But Vim's default commands a) are plenty, and b) very expressive so why bother?但是 Vim 的默认命令 a) 很多,并且 b) 非常有表现力,那何必呢? What value, exactly, are you expecting to get out of this?您希望从中获得什么价值? Why would you want to remove features from a tool whose primary selling point is that it has so many features?为什么要从一个主要卖点是它具有如此多功能的工具中删除功能?

When you define a new key mapping with noremap , or nnoremap inoremap , the default key mappings are overwritten.当您使用noremapnnoremap inoremap定义新的键映射时,默认键映射将被覆盖。

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

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