4

I'm developing plugin which will synchronize Sublime Text configuration.

The plugin core is node.js utility, which is doing all the stuff.

The next step I see is to create python wrapper for plugin which will interact with Sublime Text API and will run nodejs scipt every time text editor is opening.
And the main problem is that I don't know python.

I have researched that I need to execute this custom python code:

from subprocess import call
call(["node", "app.js", "../User/"], Shell=true)

Then I researched API and I thought that I need EventListener class, but there are no events like onEditorStart. Then I found two run_command(string, <args>), but I have any thoughts how to use it in my purposes.

Then I have explored Packages/Default/ with samples of code, which are using a lot of API functions, but still I have no idea how find usefull lines in that 101 files.

I am almost in despair, and decided to ask here. What should I code in python to force my plugin run nodejs scipt every time text editor is opening?

2
  • Would it be overkill if you run your plugin every time a a tab is created? Commented Jan 23, 2013 at 3:51
  • @CarlosV Yes, it will be overkill. And I have already found a solution Commented Jan 23, 2013 at 6:31

1 Answer 1

1

José F. Romaniello suggested working solution at gist.github.com

import sublime, sublime_plugin
from subprocess import call


class TestCommand(sublime_plugin.ApplicationCommand):
    def __init__(self):
        super(TestCommand, self).__init__()
        #do your stuf here
        # call(["node", "app.js", "../User/"], Shell=true)
        call(["ping", "192.168.1.1"])

    def run(self, edit):
        pass
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.