How to start WindowCommand plugin from `sublime console`

I created a plugin for sublime text 3with three commands: 2 of them are of type TextCommand, one of themWindowCommand

import sublime, sublime_plugin

class simple_text_pluginCommand(sublime_plugin.TextCommand):
    def run(self, edit):      
        print("Hello World simple_text_plugin")
class simple_text_plugin2Command(sublime_plugin.TextCommand):
    def run(self, edit):      
        print("Hello World simple_text_plugin2")        
class simple_window_pluginCommand(sublime_plugin.WindowCommand):
    def run(self):      
        print("Hello World simple_window_plugin")  

Why can I only call sublime command line(ctrl + `) only text commands:

>>> view.run_command('simple_text_plugin') 
Hello World simple_text_plugin

>>> view.run_command('simple_text_plugin2') 
Hello World simple_text_plugin2

But cannot call the command window:

>>> view.run_command('simple_window_plugin') 

There is no way out. How to run a type plugin windowfrom sublime console?

+4
source share
1 answer
  • ApplicationCommand: sublime.run_command('application_command_name'). Check the run_commandfunction for the module sublimein the API link .
  • WindowCommand: window.run_command('window_command_name'). Check out the method run_command sublime.Window.
  • TextCommand: view.run_command('text_command_name'). run_command sublime.View.
+10

All Articles