Use Google v8 engine to write plugins with JavaScript
- add a package.json file:
{
"name": "JSDemo",
"description": "demo plugin powered by SublimeJS",
"version": "0.1.0",
"author": {
"name": "akira-cn",
"email": "akira.cn@gmail.com"
},
"main": "index.js",
"licenses": [
{
"type": "The MIT License",
"url": "http://www.opensource.org/licenses/mit-license.php"
}
]
}
- add Javascript files:
/** index.js **/
defineCommand("Hello", require("hello.command"));
/** hello.command.js **/
module.exports = function(view, edit){
view.insert(edit, 0, "HelloWorld");
}
Thanks to emmet-sublime. Some idea is borrowed from emmet-sublime. :-)