preservim / vim-wordy

Uncover usage problems in your writing
Other
716 stars 23 forks source link

Suggestion: highlight words overused in file #23

Closed dbmrq closed 8 years ago

dbmrq commented 8 years ago

It would be great if there were a way to just highlight the words that are overused in the current file. It could work for the whole buffer and for each paragraph. So if a word were used a lot more than any other in the file it would be highlighted, and if a word were used more than, say, three times in the same paragraph, it would be highlighted too. And then there could be a way to customize how much a word can be used to trigger this and maybe a way to cycle through the most used words, highlighting one at a time.

reedes commented 8 years ago

Neat idea.

Wordy currently uses one mechanism to highlight words -- repurposing the spell checker.

I've seen use of the syntax highlighting engine to highlight words or phrases, such as instances of "the the".

There might be a way to run a script, such as

http://vim.wikia.com/wiki/Word_frequency_statistics_for_a_file

and then use custom highlight groups to color the most frequent words, similar to what is done here

http://vim.wikia.com/wiki/Highlight_multiple_words

However, I don't have the time to work on it now.

If you or anyone else wants to take a stab at it, it could be very useful.

I'd recommend that it be done as a separate plugin, which I'd mention prominently in the Wordy README. This keeps Wordy simple.

I'd recommend different modes for the different scopes of overuse: file, paragraph, sentence, etc. (yes, I used 'different' twice here :^)

dbmrq commented 8 years ago

Uhm, ok, I don't know much about vimscript, but I'll try. Getting the words seems easy, but the highlighting part is a bit more complicated. I'll see what I can do. Thanks for the answer. :)

dbmrq commented 8 years ago

Update:

I got started on this and it's still a very rough attempt, but it's going well I think: https://github.com/danielbmarques/vim-ditto

If you or anyone else manage to find some time to help it would be great. Right now I'm trying to figure this out: http://vi.stackexchange.com/q/8936/7642

reedes commented 8 years ago

Sorry, no time to assist at the moment, but glad you're making progress.

I relied heavily on this book in writing my plugins: http://learnvimscriptthehardway.stevelosh.com

dbmrq commented 8 years ago

Ok, I did it!

Evil laugh

Here it goes: https://github.com/danielbmarques/vim-ditto

I added a link to wordy at the bottom of the readme. :)

reedes commented 8 years ago

Congrats! I look forward to trying it. Installed and will try it out tonight.

reedes commented 8 years ago

Added mentions to both vim-wordy and vim-pencil plugins

dbmrq commented 8 years ago

Thank you! :) I hope you like it, let me know what you think. I expect it to to have a few bugs, but hopefully nothing too bad.