Sublime Forum

Multiple selections using different colors

#1

I"m migrating from vim which has a plugin to allow highlighting multiple matches with different colors, vim.wikia.com/wiki/Highlight_multiple_words

Is there any such animal for sublime?

I find this is invaluable when picking out matching data from files of a different format representing the same data.

0 Likes

#2

You can do this with the plugin API.

  1. Use view.sel()[0] to get the current selection.
  2. Then use find_all() on the current selection
  3. Then use add_regions with different scopes.

You can also use show_input_panel() to ask the user which scope to color the current selection with - then supply the scope entered in the input panel to add_regions.

0 Likes

#3

I found the HighlightWord plugin that does mostly what I want.
It’s serves the same function even though the highlight selection mechanism is very different. It’s not an incremental selection append to the highlight list, but it’s pretty close.

0 Likes