Wednesday, January 27, 2010

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

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()
>
> But I don't know if it's the best way to do it. I tried to search on
> Google and on this mailing list for something similar but I couldn't
> find anything.
>
> Is there a way to do this?
>
> Thank you!
>
> - Rémi

Regards,
Agathoklis

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

No comments: