1

我正在尝试使用 v8 插件在 javascript 中为 sublime text 2 编写插件。有一个名为 test.js 的演示 javascript 文件,它似乎是一个完整的测试插件,但我不知道如何激活它。

有没有人设法使用 javascript 为 sublime text 2 编写插件?

还有另一种方法可以解决这个问题吗?我主要想将文本发送到 javascript 以由我的各种库处理,然后将文本发回。


编辑:我正在使用这个项目让 v8 与 sublime 一起工作:https ://github.com/akira-cn/sublime-v8

4

2 回答 2

4

你可以试试这个插件https://github.com/akira-cn/SublimeJS

遵循示例:

/** package.json **/

{
    "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"
    }]
}
/** index.js **/

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

module.exports = function(view, edit) {
    view.insert(edit, 0, "HelloWorld");
}
于 2014-02-01T00:03:47.393 回答
1

你可以用 node.js 做到这一点。简单的 python 包装器应该可以解决问题。使用 node.js 构建插件的示例:Sublime-HTMLPrettify

于 2012-02-16T08:54:09.997 回答