Tim Chase wrote:
[Richard Querin wrote:]
Anyway, one thing I'd like to be able to do is insert some
boilerplate text into a document - something like a standard
signature. Is there some way I can preload a buffer with this
text when I run Vim? Can this be done in the rc file? I'm sure
there is a way (with Vim there always seems to be) but I can't
seem to find out how.


In your vimrc, you can add a line something like

    au BufNewFile *.txt $r ~/template.txt

where "*.txt" is the pattern to match.  Thus, if you do:

    :e nonexistant.txt

it will automatically read in the file "~/template.txt" at the bottom of the file ("$").
[...]

Or, to insert the boilerplate after the cursor line at any time during editing, use simply

        :r ~/template.txt

A line number can be inserted between : and r to mean "insert after line n" (or 0 to insert before first line, or $ to insert after last line, or... see ":help [range]").


Best regards,
Tony.

Reply via email to