Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run WindowCommand plugin from `sublime console`

I created plugin for sublime text 3 with 3 commands: 2 of them are of type TextCommand, one of them is WindowCommand

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 I can call from 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 window command:

>>> view.run_command('simple_window_plugin') 

Got no output. How to run Window type plugin from sublime console?

like image 914
Maxim Yefremov Avatar asked Oct 30 '13 08:10

Maxim Yefremov


People also ask

What version of Sublime Text has a command line interface?

Command Line Interface – Sublime Text Documentation DownloadBuySupportNewsForum DocumentationCommand Line Interface Version: Dev4.03.23.13.0 Sublime Text includes a command line tool, subl, to work with files on the command line.

How to compile and run a program in sublime?

1 Open any program file in the sublime editor and Right-click ( context menu ). 2 You can see the Cmd menu in Context menu options. 3 Click on it. 4 The command prompt will be opened through which you can compile and run your program.

What is the best cross-platform console plugin for Sublime Text?

Terminus is a recent plugin, highly under development. It's the best cross-platform console in Sublime Text that I have seen yet. Show activity on this post. Will Bond created an excellent plugin for called " Terminal " for calling the terminal at project or file levels.

How do I install Sublime Text 32 bit on Windows 8?

32bit installs on a 64bit version of Windows will be in C:\Program Files (x86)\Sublime Text\ 32bit installs on a 32bit version of Windows will be in C:\Program Files\Sublime Text\ Windows 8 Show instructions for: Windows 10, Windows 7 Press the Windows Keyand type environ Select the item Edit the system environment variables


1 Answers

  • ApplicationCommand: sublime.run_command('application_command_name'). Check run_command function for sublime module in the API reference.
  • WindowCommand: window.run_command('window_command_name'). Check run_command method of sublime.Window.
  • TextCommand: view.run_command('text_command_name'). Check run_command method of sublime.View.
like image 76
longhua Avatar answered Oct 19 '22 06:10

longhua