Last active
December 19, 2015 12:59
-
-
Save MaciekBaron/5958554 to your computer and use it in GitHub Desktop.
Simple plugin for highlighting TODOs and similar things
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sublime, sublime_plugin | |
combinations = (('todo', '(.*)TODO:(.*)', 'string'), ('fix','(.*)FIX:(.*)', 'invalid')) | |
class HighlightText(sublime_plugin.TextCommand): | |
def run(self, edit): | |
view = self.view | |
for combination in combinations: | |
regions = view.find_all(combination[1],0) | |
view.add_regions(combination[0], regions, combination[2] , '') | |
class HighlightOnSave(sublime_plugin.EventListener): | |
def on_activated(self, view): | |
view.run_command("highlight_text") | |
def on_modified_async(self, view): | |
view.run_command("highlight_text") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment