daily pastebin goal
29%
SHARE
TWEET

Untitled

a guest May 16th, 2018 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import sublime, sublimeplugin
  2.  
  3. class ExtendedView(sublimeplugin.PyView):
  4.     def buffer(self):
  5.         return self.substr(sublime.Region(0, self.size()))
  6.  
  7. class PythonApiTestCommand(sublimeplugin.TextCommand):
  8.     __viewWrapper__ = ExtendedView
  9.    
  10.     def run(self, view, args):
  11.         vCmd, options = view.cmds, view.options
  12.  
  13.         options.syntax = "Packages/Python/Python.tmLanguage"
  14.         sublime.messageBox(options.syntax)
  15.  
  16.         vCmd.move_lines_1()                                                    \
  17.             .move_lines('-1')                                                  \
  18.             .moveTo_eof()                                                      \
  19.             .insertInlineSnippet("$PARAM1", '\n#Python Rules\n')
  20.    
  21.     def onActivated(self, view):
  22.         print view.options.syntax
  23.         print view.buffer()
RAW Paste Data
Top