1

I'm trying to code some projects in flutter by the dart language.
I want to count the time that spends in insert mode to finish this project

:call Startchrono()
0 : wait to go in insert mode ...
chrono++...
7 wait to go in insert mode ...
...

1 Answer 1

2

Use InsertEnter and InsertLeave autocommands to count it:

let g:time_total = 0
let g:time_step = 0
augroup counter | au!
    au InsertEnter * let g:time_step = localtime()
    au InsertLeave * let g:time_total += localtime() - g:time_step
augroup END

Here in g:time_total there would be number of seconds you spent in insert mode.

0

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.