Vim 中 JavaScript/Jquery 的 Rails.js.erb 折叠/缩进效果好吗?
我对 vim/Macvim 相当陌生,想知道是否有人可以指导我一个插件或资源,以便在 Vim 中为 ruby on Rails javascript erb 文件获得良好的缩进和折叠,这些文件是 javascript+jquery 的混合体,其中有一些服务器-side 调用混合在一起。
我知道这是一个艰巨的任务,基本上混合了 3 种语法,但我猜有人已经解决了这个问题。
谢谢!
I'm fairly new to vim/Macvim and am wondering if someone could kindly direct me to a plugin or resource on getting good indenting and folding in Vim for ruby on rails javascript erb files that are a mixture of javascript+jquery which have some server-side calls mixed in.
I know it's a tall order with essentially 3-syntaxes being intermingled but I'm guessing someone's already solved this beast.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我遇到了 Vim/MacVim 和 Ruby 兼容性问题。第一次,我使用 Homebrew 安装,最终放弃了该版本并从源代码编译 Vim。这需要更多工作,但您可以指定编译的语言支持,并且事情会工作得更好。 这篇文章迈出了很好的一步在 Mac 上编译 Vim 的分步指南。尝试一下,然后看看
js.erb
文件是否仍然存在问题I had issues with Vim/MacVim and Ruby compatibility. The first time, I installed using Homebrew and ended up scrapping that version and compiling Vim from source. It's more work but you can specify the language support that is compiled and things work much better. This post has a good step-by-step guide on compiling Vim on Mac. Try that and then see if you still have issues with
js.erb
files根据文件的写入方式,您也许可以在缩进级别上折叠。这可以通过在 ViM 文件中传递“:set Foldmethod=indent”来完成。有关 ViM 折叠的更多信息,请访问:http://vim.wikia.com/wiki/Folding
Depending on how the file is written you may be able to fold on indentation level. This can be done by passing ":set foldmethod=indent" while in a ViM file. More information on ViM folding can be found here: http://vim.wikia.com/wiki/Folding