Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to map (alias?) a command in vim

Tags:

dictionary

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?

like image 479
user137369 Avatar asked Apr 15 '13 17:04

user137369


People also ask

How do I remap a key in Vim?

To map a sequence of keys to execute another sequence of keys, use the ':map' command. For example, the following command maps the <F2> key to display the current date and time. The ':map' command creates a key map that works in normal, visual, select and operator pending modes.

What is the alias command in Linux?

alias command instructs the shell to replace one string with another string while executing the commands. When we often have to use a single big command multiple times, in those cases, we create something called as alias for that command.


1 Answers

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
like image 129
Ingo Karkat Avatar answered Oct 07 '22 00:10

Ingo Karkat