Wednesday, January 27, 2010

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

Hi Agathoklis,

Agathoklis D. Hatzimanikas a écrit :
> > 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

It worked almost perfectly! I modified it a bit to be less specific
and
to store the whole file path.

function! RecordFileOpen()
let record = "\t(".strftime("%F %T").")\t".expand("%:p")
redir >> /path/to/log_file
echo record
redir END
endfunction

autocmd! BufReadPre * exe RecordFileOpen()

Thank you very much for you help!

--
Rémi Prévost
http://remiprevost.com
http://pubwich.org

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

No comments: