As far as I know there is no built-in method for this, but I extended g<C-g>
using the following function:
fun! s:readtime()
let l:status = v:statusmsg
try
exe "silent normal! g\<C-g>"
echo printf('%s; About %.0f minutes',
\ v:statusmsg, ceil(wordcount()['words'] / 200.0))
finally
let v:statusmsg = l:status
endtry
endfun
nnoremap g<C-g> :call <SID>readtime()<CR>
I opted to extend the <C-g>g
output with an estimate of the reading time:
Col 1 of 17; Line 62 of 131; Word 261 of 510; Byte 1967 of 3920; About 3 minutes
This assumes a reading speed of 200 words per minute.
The trick is that you can read and write v:statusmsg
to display a message in the commandline, so this first runs the default g<C-g>
, captures the output, get the word count, adds the reading time, and sets the statusmsg again.
You can do the same but not set v:statusmsg
at the end if you want it mapped to a separate key, or run it as a command.
Note that this will only give you a naïve estimate which us unaware of syntax. It should be accurate enough for simple markup languages like Markdown, but it won't work well for more verbose markup such as HTML.