I'm trying to write a plugin that highlights overused words.
After much effort I managed to write a function (and a command,
:Ditto) that will highlight the most used word in the file or in a specific range. So I can select a paragraph and call that function and the most frequent word in that paragraph will be highlighted.
Now I want to be able to call that function/command once for every paragraph in the file. So instead of selecting each paragraph and calling it I'd be able to do it just once and the most frequent word in each paragraph would be highlighted in that paragraph.
How could I go about that?
PS: Any other ideas/suggestions/recommendations are more than welcome. I know nearly nothing about vimscript. Also it would be great if besides running the function once for each paragraph the plugin could do it once per sentence and maybe other scopes… and after that I hope to be able to cycle through the most used words, so I could see the second most used word, then the third, and so on. I thought I'd start with my current problem, which is just running that function once for each paragraph, but if anybody can help with the rest that would be awesome too. Thanks! :)