tags:

views:

559

answers:

1

As title, any convenient way?

I especially need it for some cvs/git commit or sendmail to load a template comment. I think it is a vi environment, not vim.

+5  A: 

at the VIM command prompt:

:read new_file

or for short:

:r new_file

This will insert the contents of new_file under where the cursor is. For instance if this is the contents of new_file:

I do not like green eggs and ham 
I do not like you sam I am

And this is the text you're editing:

I meant what I said and I said what I meant
An elephant's faithful one hundred percent.
              ^

And your cursor is on the first line and you type:

:read new file

Then your buffer will be:

I meant what I said and I said what I meant
I do not like green eggs and ham 
I do not like you sam I am
An elephant's faithful one hundred percent.
Nathan Fellman
works well, thanks.
arsane
or just :r file if you are lazy like me
Ben
True. I was trying to be complete. I'll ad that to the answer
Nathan Fellman
As a side note, combined with ! you can also read the output of a command into vim. :r !ls
Blixtor