vasconcelloslf/vim-interestingwords — pull request #7 by gelguy (2014-09-11 02:05:37+00:00)
Title: A bit of refactoring, bug fix and feature

I fixed a bug where due to the usage of the word's index in s:interestingWords.
Since mid is gotten through 86750+n, where n is the length of the s:interestingWords list + 1, when we uncolor a word the list gets shorter so n ends up being reused. This results in an id already being used error. I have fixed this by using a dictionary where the keys are the words and the values are the mids. s:interestingWords is now a list where the indexes of 0 indicate that the color is not taken and more importantly indicate the n value to generate mid is not taken.

A bit of refactoring around, mainly to reuse code and make it flow more logically.
Calling InterestingWords() checks if the word is already colored and performs Color() or Uncolor() instead of Uncolor() being nested in Color(). Argument passed to Color() and Uncolor() changed to the word itself rather than getting the \ in both functions. UncolorAll just calls Uncolor() on all the s:interestingWords.

Changed the value of n to get mid from 86750 to 595129 (random prime) as I believe 86750 is being used in some .vimrcs and some other plugins e.g. Mark.vim.

New feature - when max number of highlight reached, uncolor a previous highlight and apply that color to the new highlight. The color is chosen is the least recently used one.
```
let g:interestingWordsCycleColors = 1
```

Really like this plugin!