在vim中嵌入node.js?
可以使大型 vim 脚本项目变得更容易的一件事是它的嵌入式解释器支持。 MacPorts 的官方版本中包含一个 --enable-rubyinterp
标志,并由 两面神。
有没有办法在vim中嵌入node.js?
One thing that can make large vim scripting projects easier is its embedded interpreter support. There's an --enable-rubyinterp
flag that is included in the official builds for MacPorts, and used by janus.
Is there a way to embed node.js in vim?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从这个问题来看,我假设你想要一个嵌入式解释器,可以像使用 Perl、Python、Ruby、Tcl、Scheme 和 Lua 一样直接编写 vim 脚本 - 因此,例如,你可以在 .vimrc 中用 Python 编写 vim 函数,或者你可以用 Ruby 编写一个插件。这与使用vim启动用node.js编写的外部程序不同,也与使用vim(以及各种第三方插件)帮助你在node.js中编写程序不同。
这些嵌入式接口被硬编码在 vim 源代码中,目前还没有对 Node.js 的类似嵌入式支持,也没有用于嵌入任意解释器的通用运行时机制。 (ConqueTerm 插件、异步库等方面可能存在一些 hacky 解决方法)
如果您想亲自检查并了解当前支持的方式,您可以使用以下说明查看当前代码:< a href="http://www.vim.org/mercurial.php" rel="nofollow">http://www.vim.org/mercurial.php。在 Makefile 中查找对语言的引用(我看到“Perl、Python、Python3、TCL、Ruby、MZscheme、Lua”)。在 src/ 目录下查找与 glob if_*.c 匹配的文件 - 我的结果如下: if_cscope.c、if_lua.c、if_mzsch.c、if_perlsfio.c、if_python3.c、if_python.c、if_ruby.c、 if_sniff.c、if_tcl.c、if_xcmdsrv.c(其中一些是具有特殊接口的外部工具,而不是嵌入式解释器)。
如果您需要在 vim 中嵌入 node.js 支持,那么您可能必须自己编写它。如果您不需要实际使用 JavaScript 编写 vim 插件,可能有更好的方法来满足您的需求。
From the question I assume you want an embedded interpreter with which to directly script vim as one can do with Perl, Python, Ruby, Tcl, Scheme and Lua - so, for example, you could write vim functions in Python in your .vimrc, or so you can write a plugin in Ruby. This is different from using vim to launch external programs written in node.js, and it is different from using vim (and various third-party plugins) to help you write programs in node.js.
These embedded interfaces are hard-coded in the vim source and at this time there is no comparable embedded support for node.js, nor is there a general run-time mechanism for embedding an arbitrary interpreter. (There may be hacky workarounds in the vein of the ConqueTerm plugin, async libraries, etc.)
If you want to check for yourself and see what is currently supported in this way, you can check out the current code by using these instructions: http://www.vim.org/mercurial.php. Look for references to languages in the Makefile (I see "Perl, Python, Python3, TCL, Ruby, MZscheme, Lua"). Look under the src/ directory for files matching the glob if_*.c - my results are as follows: if_cscope.c, if_lua.c, if_mzsch.c, if_perlsfio.c, if_python3.c, if_python.c, if_ruby.c, if_sniff.c, if_tcl.c, if_xcmdsrv.c (several of these are external tools with special interfaces, rather than embedded interpreters).
If you need embedded node.js support in vim then you will probably have to write it yourself. If you do not need to actually write vim plugins using JavaScript, there is probably a better way to meet your needs.