This is a plugin that highlights all occurrences of the current word in the current view. The current word is defined as the string of characters that contains the cursor position and starts and ends with a character from the word_separators setting. The plugin also delays the search by 0.5 seconds, so on large documents it will not do the search on every keypress, which really makes it feel much more responsive. There is a highlight_word_theme_selector setting which defaults to comment. This allows you to customize the color of the highlighted words independently of other theme settings. (I used this because I wanted the highlighted words to be similar to search results, but just a little darker, so the theme selector helps).
This is my first plugin, I found the basic idea from a similar current word plugin but added a few features.
I had a few questions too though if anyone has ideas:
1. It looks like there is no way to stop a timeout or tell it to repeat. I worked around this, but it might be a nice thing to have?
2. Are there any threading issues that need to be taken care of in the timeouts? I haven't done this, but what I would like to do is to store a reference to a view object in an event handler, and then access it later in the timeout. Is that possible?
3. I tried to setup my theme to highlight the current word with a green background. For whatever reason, when I set the background key in the theme for that selector to green, it did nothing. When I set the foreground selector to green, it made the background green and the text of the word pink. I would really like the text to be white for some more contrast, can that be done? How? Is there a reason the foreground setting is used for the background?
Here is the code: github.com/ajpalkovic/SublimePl ... ghlight.py