Home Download Buy Blog Forum Support

Multiple selections using different colors

Multiple selections using different colors

Postby bedge on Tue Apr 23, 2013 5:01 pm

I"m migrating from vim which has a plugin to allow highlighting multiple matches with different colors, http://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.
bedge
 
Posts: 5
Joined: Tue Apr 23, 2013 4:56 pm

Re: Multiple selections using different colors

Postby robertcollier4 on Tue Apr 23, 2013 6:33 pm

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.
The scope is used to source a color to draw the regions in, it should be the name of a scope, such as "comment" or "string".


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.
robertcollier4
 
Posts: 153
Joined: Sun Feb 24, 2013 5:37 pm

Re: Multiple selections using different colors

Postby bedge on Thu Apr 25, 2013 4:46 pm

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.
bedge
 
Posts: 5
Joined: Tue Apr 23, 2013 4:56 pm


Return to General Discussion

Who is online

Users browsing this forum: Exabot [Bot] and 24 guests

cron