4

I'm interested (mostly just for fun) in seeing my typing speed while working in Vim. I saw this post but this requires starting and stopping a function. I would prefer this to be a constantly updating value in the bottom bar of Vim (similar to cursor position or something like that), perhaps taking and average of words written over the last 15 seconds and extrapolated to words per minute?

Not necessary, but if you could also provide some explanation of how your solution works that would be greatly appreciated! I'm still pretty new to the more interesting features of Vim and would love the opportunity to learn.

Thanks in advance! Any hints in the right direction would also be greatly appreciated!

EDIT: This is a somewhat working version of what I want. I believe the main issue with this is that the time updates too frequently.

let g:last_word_count=[wordcount().words, reltimefloat(reltime())]
function WPM()
        if abs(reltimefloat(reltime()) - g:last_word_count[1]) > 0.5
                let g:timedif=abs(reltimefloat(reltime()) - g:last_word_count[1])
                let g:worddif=min([wordcount().words - g:last_word_count[0], 0])
                echom g:worddif
                let g:wpm=g:worddif / g:timedif * 60

                return string(g:wpm)
        endif
endfunction
1
  • 3
    Welcome to Vi and Vim! This is an interesting question, but will likely take significant effort from someone to build, so don't hold your breath waiting for replies :)
    – D. Ben Knoble
    Nov 7, 2021 at 19:07

1 Answer 1

0

There is wpm plugin for neovim. But it is no longer mentioned by the owner. I think this would be a great starting point if you want to develop your own plugin. https://github.com/jcdickinson/wpm.nvim

1
  • Thank you! I'll be sure to look into this and report back if i manage anything interesting
    – kipawaa
    Jan 5 at 22:08

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.