Last active
August 29, 2015 14:07
-
-
Save adamloving/219b03b1f0577ee20c49 to your computer and use it in GitHub Desktop.
Sublime Text 3 plugin to detect window modification (couldn't figure out how to update other window)
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
# put this in /Users/adam/Library/Application Support/Sublime Text 3/Packages/User/babelfish.py | |
import sublime, sublime_plugin | |
class Bablefish(sublime_plugin.EventListener): | |
def on_modified(self, view): | |
print(view.file_name(), "modified") | |
w = view.window() | |
if w.num_groups() > 1: | |
# todo: create secondary view if necessary | |
views = w.views_in_group(1) | |
print(len(views), "views") | |
output_view = views[0] | |
## output_view.begin_edit() | |
def on_load(self, view): | |
print(view.file_name(), "just got loaded") | |
def on_pre_save(self, view): | |
print(view.file_name(), "is about to be saved") | |
def on_post_save(self, view): | |
print(view.file_name(), "just got saved") | |
def on_new(self, view): | |
print("new file") | |
def on_activated(self, view): | |
print(view.file_name(), "is now the active view") | |
def on_close(self, view): | |
print(view.file_name(), "is no more") | |
def on_clone(self, view): | |
print(view.file_name(), "just got cloned") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment