简体   繁体   English

Vim:更改命令行模式的映射 (:)

[英]Vim: change mapping for command-line mode (:)

I want to change the shortcut for entering command-line mode in vim from : to ;我想将vim中进入命令行模式的快捷方式从:改为; . .

I can do:我可以:

:map ; :

and that works, but now I want to remap : to other command.这有效,但现在我想重新映射:到其他命令。 If I do that ;如果我这样做; is changed too and I cannot enter command line mode any more.也改变了,我不能再进入命令行模式了。

I suppose I should use something like:我想我应该使用类似的东西:

:map : <command-line-mode>

but I don't know the correct command to use.但我不知道要使用的正确命令。

:noremap ; :
:noremap : <something else>

Using map only will map the key recursively, meaning if you map ;使用map只会递归地使用 map 密钥,这意味着如果您使用 map ; to : , then : to someting else, now both ; to : , then : to someting else, now both ; and : will do whatever you mapped : to do.:会做任何你映射:做的事情。 Because ;因为; is mapped to do whatever : does.被映射为做任何事情:做。 to prevent this recursive behavior, use non-recursive maps noremap , which will map each key independently of what the mapped-to key does.为了防止这种递归行为,请使用非递归映射noremap ,它将 map 每个键独立于映射到键的作用。

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

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