As a distraction free writing environment, vim has worked great for me in the past. And using sites like 750words.com leads to me being more distracted. It’s far easier for me to full-screen vim and use that as a distraction-free environment. 750words.com has one thing that I like – A live word count in the footer of the page, so I know when to stop. I did some googling around and here’s what I found on stackoverflow for doing something similar in vim.
Add the following to your .vimrc
" Live Word Count function! WordCount() let s:old_status = v:statusmsg let position = getpos(".") exe ":silent normal g<c-g>" let stat = v:statusmsg let s:word_count = 0 if stat != '--No lines in buffer--' let s:word_count = str2nr(split(v:statusmsg)[11]) let v:statusmsg = s:old_status end call setpos('.', position) return s:word_count endfunction
And then, if you’re using ftplugin, add this to .vim/ftplugin/markdown.vim
setlocal statusline=wc:{13371f13f0bf161e7595c2ac5df92e005bed3de1d132ef646d0a44f3a1a9ee62}{WordCount()}
This will give you a small counter at the bottom with the word count, like so.
Leave a Reply