How to write a shortcut in vim?

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

+3
source share
3 answers

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

Usually you can just type :Opeand then press tab, and vim will complete the full name of the command.

Note that your command must start with an uppercase letter, because only vim built-in commands can begin with lowercase letters.

+1
source

Add this to your .vimrc:

map :open_my_document :e /var/book/document.txt
0
source

, - :h cabbr :h cmap.

cabbr, . cmap, . , , .

/ , cmap.

0
source

Source: https://habr.com/ru/post/1736415/


All Articles