On Sep 16, 12:46 am, Gary Johnson <[email protected]> wrote:
> On 2011-09-15, Stanley Rice wrote:
>
> > I am sorry that I didn't fully express my question. In short, all I
> > want to do
> > it to insert a string , i.e."Modified:" in the first line of a newly
> > open file.
> > Is that possible?
>
>     au BufNewFile *.txt put! ='Modified:'
>
> where you should change the file pattern "*.txt" to match the type
> of file you want this for.
>

Yes, or follow my suggestions. :help skeleton tells you exactly how to
read in a file's content to automatically add it to new files. The
wiki link I gave shows how to expand this idea to allow Vim to do some
automatic processing like adding a current timestamp or date or
whatever.

The put! command given by Gary should also work, it's just a different
method which will work well for very small file templates, such as
adding a single "modified" line only.

-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to