如何向vim添加javascript(html5对象)的自动完成功能?
我想使用 vim 作为 javascript 编辑器,并且我需要自动补全:) 例如:
var context = canvas.getContext("2d");
// ^
// |
// +----- Here I should have list of `canvas` methods after pressing Tab (SuperTab plugin).
var grd = context.createLinearGradient(0, 100, 200, 0);
// ^
// |
// +----- The same is here but for `context`.
grd.addColorStop(0, "#aabbcc");
// ^
// |
// +----- Again
grd.addColorStop(1, "#ccbbaa");
// ^
// |
// +----- And again... You've got a point :)
另外,我需要有关这些方法的参数的信息。
vim 中可以拥有所有这些东西吗?
据我了解,我应该以某种方式连接一个可以通过 vim 提供此类信息的 javascript 解析器。对于 C++,这可以通过 clang 实现。 javascript 有类似的东西吗?
I want to use vim as editor for javascript and I need autocompletion :)
For example:
var context = canvas.getContext("2d");
// ^
// |
// +----- Here I should have list of `canvas` methods after pressing Tab (SuperTab plugin).
var grd = context.createLinearGradient(0, 100, 200, 0);
// ^
// |
// +----- The same is here but for `context`.
grd.addColorStop(0, "#aabbcc");
// ^
// |
// +----- Again
grd.addColorStop(1, "#ccbbaa");
// ^
// |
// +----- And again... You've got a point :)
Also, I need information about parameters of these methods.
Is it possible to have all these things in vim?
As far as I understand, I should somehow connect a javascript parser that can provide such information with vim. This is possible for c++ via clang. Is there something similar for javascript?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道有什么统包解决方案:所有可用的 JavaScript 语法文件都没有附带 HTML5 API 支持,而且我从未见过提供 HTM5 API 相关补全的替代
javascriptcomplete.vim
。但是,从剧本的外观来看,我认为这是可行的。
I don't know of a turnkey solution: none of the available JavaScript syntax files come with HTML5 API support and I've never seen an alternative
javascriptcomplete.vim
that provide HTM5 API-related completion.But, judging by the looks of the script, I think it's doable.