Question

My work as a web programmer involves a lot of editing files from remote servers using vim. I need to report how much time it took to solve a particular case, and I have a little trouble with it: I can't get used to time tracking software, because I always forget about the fact I need to track my time. This is only an issue in cases that take a little amount of time, from about 5 to 60 minutes.

However, as far as I do all my work in vim, I'm wondering if there is any way to see which document was saved at which time. Of course, I can define some autocommands which save current time and filename to a certain file, but is there a built-in feature to do so?

Was it helpful?

Solution 2

If someone is interested, there is my own solution with autocommands:

function! ReportFileSaveTime()
" Saves current time and file to a certain file
    call system('echo `date +"%Y-%m-%d %H:%M:%S"` ' . @% . ' >> ' . g:fileSaveLog)
endfunction
au! BufWritePost * call ReportFileSaveTime()
let fileSaveLog='~/.vim/filesave'

Then you can, for example, $ tail -n 30 ~/.vim/filesave to see 30 last file save time marks.

OTHER TIPS

If you have Vim still open, you can list the file modification times of all listed buffers:

for bufnr in filter(range(1, bufnr('$')), 'buflisted(v:val)')
    echo bufname(bufnr) strftime('%c', getftime(bufname(bufnr)))
endfor

If you use an MRU plugin, you could retrieve a list of the last edited files from there.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top