-
-
Save mdpauley/6224810 to your computer and use it in GitHub Desktop.
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 | |
from os.path import splitext | |
from os.path import isfile | |
class MoveWindowCommand(sublime_plugin.EventListener): | |
def on_load(self, view): | |
window = sublime.active_window() | |
myView = window.active_view() | |
fileName, fileExtension = splitext(view.file_name()) | |
if fileExtension == '.xml': | |
window.set_view_index(myView, 1, 0) | |
elif fileExtension == '.tss': | |
window.set_view_index(myView, 2, 0) | |
elif fileExtension == '.js': | |
window.set_view_index(myView, 0, 0) | |
if isfile(fileName.replace('/controllers/','/views/')+'.xml'): | |
window.open_file(fileName.replace('/controllers/','/views/')+'.xml') | |
if isfile(fileName.replace('/controllers/','/styles/')+'.tss'): | |
sublime.set_timeout( | |
lambda: | |
window.open_file(fileName.replace('/controllers/','/styles/')+'.tss') | |
, 100) | |
else : | |
window.set_view_index(myView, 0, 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Any reason why this doesn't work when there is no previous file open?