Wednesday, January 27, 2010

Re: How to keep an external log of each file opened in vim?

On Wed, Jan 27, at 04:11 Agathoklis D. Hatzimanikas wrote:
> Hi Rémi,
>
> On Wed, Jan 27, at 05:27 Rémi Prévost wrote:
> > Sometimes I need to remember which set of files I was working on a few
> > days ago, and I'd like vim to seamlessly store the path of each file I
> > open (along with the date) in this kind of format:
> >
> > (2010-01-27 08:20:00) /Users/remi/somefile.txt
> > (2010-01-27 08:25:00) /Users/remi/otherfile.txt
> >
> > I tried to come up with something but the far I could get was there:
>
> You can try the following (substitute the path to the file you want to
> save your records):
>
> function! RecordFileOpen()
> let record = "\t(".strftime("%F %T").")\t/Users/remi/".expand("%:t").".txt"
> redir >> /path/to/file
> echo record
> redir END
> endfunction
>
> > autocmd! BufReadPre * exe RecordFileOpen()

Sorry, I forgot but you need another event also, BufEnter is a choise
that works.

Regards,
Agathoklis

--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

No comments: