Skip to content

Instantly share code, notes, and snippets.

@MaciekBaron
Created November 1, 2013 10:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MaciekBaron/7263887 to your computer and use it in GitHub Desktop.
Save MaciekBaron/7263887 to your computer and use it in GitHub Desktop.
Plugin for highlighting TODOs
import sublime, sublime_plugin
combinations = (('todo', '(.*)TODO:(.*)', 'variable.parameter'), ('fix','(.*)FIX:(.*)', 'invalid.depricated'), ('notabene', '(.*)NB:(.*)', 'string'))
class HighlightText(sublime_plugin.TextCommand):
def run(self, edit):
view = self.view
for combination in combinations:
view.add_regions(combination[0], view.find_all(combination[1],0), 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