Search code examples
vimtime-tracking

Is there any built-in way to list all the save time of the last edited files?


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?


Solution

  • 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.