1

I am trying to write plugins for sublime text 2 in javascript, using the v8 plugin. There is a demo javascript file called test.js, which seems to be a complete test plugin, but I can not figure out how to activate it.

Has anyone managed to write a plugin for sublime text 2 using javascript?

Is there another way to approach this? I mostly want to send text to javascript to be processed by my various libraries and then send text back.


EDIT: I am using this project to get v8 working with sublime: https://github.com/akira-cn/sublime-v8

2 Answers 2

4

You can try this plugin https://github.com/akira-cn/SublimeJS

Follow example:

/** package.json **/

{
    "name": "JSDemo",
    "description": "demo plugin powered by SublimeJS",
    "version": "0.1.0",
    "author": {
        "name": "akira-cn",
        "email": "[email protected]"
    },
    "main": "index.js",
    "licenses": [{
        "type": "The MIT License",
        "url": "http://www.opensource.org/licenses/mit-license.php"
    }]
}
/** index.js **/

defineCommand("Hello", require("hello.command"));
/** hello.command.js **/

module.exports = function(view, edit) {
    view.insert(edit, 0, "HelloWorld");
}
Sign up to request clarification or add additional context in comments.

Comments

1

You can do that with node.js. Simple python wrapper should do the trick. An example of plugin build with node.js: Sublime-HTMLPrettify

1 Comment

I am trying to do it with v8, via github project (see edit). Thanks anyway.

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.