Reputation: 58619
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
Upvotes: 1
Views: 1468
Reputation: 4009
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");
}
Upvotes: 4
Reputation: 71
You can do that with node.js. Simple python wrapper should do the trick. An example of plugin build with node.js: Sublime-HTMLPrettify
Upvotes: 1