- Author: [email protected]
- Last Modified:2016年06月15日 星期三 21时59分30秒 三
Track vim action: how long you have been working on vim, what programming languages(filetype) are you using today.
- I write this program to practice using
Parsec
in haskell - Parse log file generated by vim-activity-log and record how long you have spent on vim per day and per language
- So you need to have vim plugin vim-activity-log installed
- vim-activity-log is forked from here, I did some minor modification to make the log format more consistent.
- This program could (and perhaps should) be used together with
crontab
$ cabal sandbox init
$ cabal install
You should specify a folder to save log in .vimrc
for vim-activity-log
let g:activity_log_location = '~/.activity_vim/%Y/%m/%d.log'
Then:
$ record-vim-time today --dir /path/to/activity_log_location
The program would look for your today's log and calcuate time you spent on vim. This should be what you'll see:
haskell: 00:15:48
markdown: 00:03:42
cabal: 00:01:02
gitcommit: 00:00:33
sh: 00:00:24
=============================
There is such situation that: you opened vim, did some coding, then you walked away(to have lunch, for example) without closing vim and didn't save your buffer, then you get a very very long action interval, and the recorded active time would be much longer than the time you actually spent on coding, to avoid this, you can specify a maxInterval
like this
$ record-vim-time today --dir /path/to/activity_log_location --maxInterval 1800
Thus, intervals longer than 1800 seconds would be ignored
Instead of specify a directory and lookup your today's action, you can specify a specific log file. For example, if you want to lookup you vim action in 2015/06/04, you should do this:
$ record-vim-time file --file /path/to/activity_log_location/2015/06/04.log --maxInterval 1800
Released under the WTFPL(DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE) license.