I use vim for coding and also for writing scientific articles and book chapters.

It would be very interesting to know the time I spent on a file. For example how many hours or minutes the buffer was open in total, per day, etc.

Ideally, one also could see the writing speed (I use Colemark and Steno/Plover for writing).

I did not find a suitable plugin; is there one? How could I build my own 'academic writers' plugin?

I mainly program in Python, but I would adjust to other programming languages, if necessary (I am co-author of Pandoc-Scholar).

  • 1
    Welcome to Vi and Vim! I've made a few edits to your post—I assumed Phython was a typo for python; if this is not correct, feel free to edit and correct it
    – D. Ben Knoble
    Commented May 4, 2021 at 16:37
  • Yes! Thanks, Ben! Commented May 4, 2021 at 16:49
  • I've never seen such a plugin but a very basic version could be implemented with autocommands: you could use BufEnter and BufLeave to start and stop a timer, keep a track of the time spent in each buffer with buffer-local variables, dump the whole stats in a global variable and write that to a file. Then you'd have an external program or a custom command to consolidate everything to have time per day. The writing speed would be harder to do because it's not trivial to keep track of exactly what you modified and at which pace. That sounds like a cool plugin idea!
    – statox
    Commented May 4, 2021 at 17:13
  • So... I was about to start writing my own plugin vim-chronos and decided to duck it just to be sure and I found chronos it doesn't look exactly what you are looking for but it could be an interesting basis. The point about not being able to detect when your terminal vim looses focus sounds quite important.
    – statox
    Commented May 4, 2021 at 17:35
  • 1
    @statox an interesting find. I wonder about modernizing it
    – D. Ben Knoble
    Commented May 5, 2021 at 2:21


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.