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
2010-03-11 02:18:06
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
2010-03-11 03:19:09
+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
2010-03-11 03:25:19