This file contains 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 | |
import time, os | |
# This class executes a callback function once self.delay seconds have elapsed since the last call to timer.notify() | |
# This allows a method like on_modified to repeatedly call notify without triggering the event multiple times per second. | |
class DelayedTimer: | |
def __init__(self, delay, callback): | |
self.delay = delay | |
self.callback = callback | |
self.lastRequest = 0 |
This file contains 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 | |
import math, time | |
# two globals store the complete clipboard history and position so that it is shared between all the various actions | |
_clipboardHistory = [''] | |
_clipboardIndex = 0 | |
class ClipboardHistoryBase(sublime_plugin.ApplicationCommand): | |
# gets/sets the sublime clipboard | |
def clipboard(self, content=None): |
This file contains 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 | |
import time | |
key = "HighlightCurrentWord" | |
# The search is performed half a second after the most recent event in order to prevent the search hapenning on every keypress. | |
# Each of the event handlers simply marks the time of the most recent event and a timer periodically executes doSearch | |
class HighlightCurrentWord(sublime_plugin.EventListener): | |
def __init__(self): | |
self.previousRegion = sublime.Region(0, 0) |
This file contains 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
syntax :html do | |
# apply this syntax to .html and .htm files | |
extension "html", "htm" | |
# color an entire tag green | |
green :begin => "<", :end => ">" do | |
#apply the following rules only to the stuff between the <> | |
# color the tag content yellow (so the <> are green) | |
yellow /.*/ |
This file contains 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
module Ruco | |
class History | |
attr_accessor :timeout | |
def initialize(options) | |
@options = options | |
@stack = [@options.delete(:state)] | |
@timeout = options.delete(:timeout) || 0 | |
clear_timeout | |
@position = 0 |