Sublime Forum

How are ApplicationCommands invoked and other questions

#1

Hi all,

Sorry for the vagueness of the subject. I’m just not really sure for what to ask. My current enterprise uses old HomeSite scripts to do a variety of things, and I’m looking to try to reproduce some of that functionality within Sublime. Many of these scripts invoke external commands to do diffs or open files by converting the a passed URL to a file path. Out of the three objects, it seems like the sublimeplugin.ApplicationCommand is the most likely candidate from which to start, but I do not understand how to invoke such a plugin to do any testing to get started.

I have reviewed a few tutorials, but none of them seem to be what I need.

Would anyone be willing to point me to a tutorial or documentation that can help me out in this specific area?

0 Likes

#2

You can either launch it from python via sublime.run_command or you can create a key binding or create a menu entry. There’s a tutorial linked from the root documentation page going into more details.

0 Likes

#3

I’ve reviewed those resources, but I still cannot figure it out. I don’t have a view with which to work, so I’m confused as to how I can invoke the plugin that from the Python console built into Sublime. The tutorial shows to run the command as follows:

view.run_command('hello')

I’ve also tried using:

sublime.run_command('hello')

I’ve tried creating a key binding in my user file:

{ "keys": "super+shift+h"], "command": "hello" } ]

All I’m trying to do at the moment is to just print something to the console that doesn’t use the

[code]import sublime, sublimeplugin

class HelloCommand(sublime_plugin.ApplicationCommand):
def run(self, args):
print “Hello”[/code]

Ultimately, I’d like to make a plugin that will prompt me for a URL that will go fetch that file based on specific parameters like drive mappings. But to get there, I need to understand how to do basic stuff like this.

0 Likes

#4

It is sublime_plugin.

Also check the Console (Ctrl- ’ (apostrophe)) for any error message.

0 Likes

#5

Bah! I should have known it was some mundane typo.

Thanks!

0 Likes