On 2014-12-04, jy yap wrote:
> On Tuesday, December 2, 2014 12:32:28 AM UTC, Gary Johnson wrote:
> > On 2014-12-01, jy yap wrote:
> > > Hi,
> > > 
> > > I have a small project that looks at logging the names of the
> > > files that have been edited by vi.
> > > 
> > > Can someone kindly point out which part of the code handle files?
> > 
> > This can be done with a plugin.  You don't need to modify Vim's
> > source code.
> > 
> > If you want to do this for all users, put the following in a file in
> > the $VIM/vimfiles/plugin directory.  You could name the file
> > editlog.vim, for example.
> > 
> >     au BufWrite * !echo <afile> >> /path/to/log/file
> > 
> > See
> > 
> >     :help 40.3
> >     :help 41.11
> > 
> > If that doesn't meet your needs, let us know more precisely what you
> > need and we can at least point you to the appropriate section of the
> > manual.
> > 
> > Regards,
> > Gary
> 
> Thank you Gary.

You're welcome.

> I wish to customize the log messages to capture other information
> in addition to filenames. Could you suggest where should start to
> look at?

That depends entirely on what "other information" you need to
capture.

If you're going to write very much to that log file, you may want to
encapsulate all that in a function and call that function from the
autocommand.  See

    :help 40.3

It may also be better to use the writefile() function to write to
the log file instead of using echo, especially if you are running on
Windows.  See

    :help writefile()

Since this is for a log file, note the use of the "a" flag to append
to the file.

To use that, you'll need to know about lists.  See

    :help Lists

Depending on what information you want to log and how you want to
capture and/or log it, you may want to take a look at the following
as well.

    :help system()
    :help function-list

To find out more about using the help system, see

    :help

Regards,
Gary

-- 
-- 
You received this message from the "vim_dev" 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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui