简体   繁体   中英

How to map (alias?) a command in vim

Lets say, hypothetically, that I always forget the command :vsplit , and always think it's :vdivide .

Is there a way to map (I'm not sure if that'd be the right thing to call it, since it's a command) one to the other?

User defined command can only start with an uppercase letter, so you can only add :Vdivide but not :vdivide .

Add in your .vimrc

 command Vdivide vsplit

To get around the limitation that user-defined commands must start with an uppercase letter, I recommend the cmdalias.vim - Create aliases for Vim commands plugin. With it, you can do:

:Alias vdivide vsplit

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.

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