tags:

views:

58

answers:

3

I want to add a shortcut like I type :open_my_document, it become :e /var/book/document.txt. how to?

A: 

Add this to your .vimrc:

map :open_my_document :e /var/book/document.txt
Auguste
A: 

I think you might be looking for something like :h cabbr or :h cmap.

If you use cabbr, your text will not change once you enter your custom command. If you use cmap, it will. It's easier to just try both out to see which you'd rather use.

I don't know advantages/disadvantages of one or the other, personally, I use cmap.

Randy Morris
+1  A: 

If you want to create a custom command, use :command:

:command Open_my_document e /var/book/document.txt

Then you can use:

:Open_my_document

Normally you can just type :Ope and then hit tab and vim will complete the full command name.

Note that your command needs to start with a capital letter because only built-in vim commands can start with lower-case letters.

too much php