I want to change the shortcut for entering command-line mode in vim from :
to ;
.
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 ;
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.