Writing a vim function to insert a block of static text

Late to the party, just for future reference, but another way of doing it is to create a command, e.g.

:command Inshtml :normal i your text here^V<ESC>

The you can call it as

:Inshtml

Explanation: the command runs in command mode, and you switch to normal mode with :normal, then to insert mode with ‘i’, what follows the ‘i’ is your text and you finish with escape, which is entered as character by entering ^V

It is also possible to add arguments, e.g.

:command -nargs=1 Inshtml :normal i You entered <args>^V<ESC>

where <args> (entered literally as is) will be replaced with the actual arguments, and you call it with

:Inshtml blah

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)