在rails.vim中,为什么我会收到“E345无法在路径中找到文件”?错误?
我一直在用 vim 学习 Ruby/Rails。 Tim Pope 的 rails.vim 似乎是一个非常好的遍历文件的工具,但我不断收到这些讨厌的“E345 can”找不到路径中的文件”错误。我还不是 vim 专家,所以解决方案并不明显。另外,我尝试过 this 它不适用于我的问题。
作为问题的一个例子。我在 app/helpers/application_helper.rb 中定义了一个方法 format_name ,它在 app/helpers/messages_helper.rb 中使用。在后一个文件中,我将光标放在 format_name 的用法上,然后点击 gf ,然后出现该错误。与 ]f 和 [f 等命令类似的功能
但是,它有时会起作用。我能够从 user
转到 app/models/user.rb
想法吗?
I've been learning Ruby/Rails with vim. Tim Pope's rails.vim seems like a really good tool to traverse files with, but I keep getting these pesky "E345 can't find file in path" errors. I'm not vim expert yet, so the solution isn't obvious. Additionally, I've tried this and it doesn't apply to my problem.
As an example of the problem. I have a method format_name defined in app/helpers/application_helper.rb and it is used in app/helpers/messages_helper.rb. Within the latter file I put my cursor over the usage of format_name and then hit gf and I get that error. Similar disfunction with commands like ]f and [f
However, it works sometimes. I was able to gf from user
to the app/models/user.rb
Ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为这是 Rails.vim 的限制。它不支持“查找”裸方法。支持类似的东西需要以下之一:
(对于大型项目来说这可能会很昂贵),
(例如 Exuberant Ctags 和
g
Control-];请参阅:help g_CTRL-]
),或者(这很难正确做到)。
如果您知道方法在哪里,则可以使用方法名称扩展许多导航命令:
但是,您不必输入所有内容。假设光标位于
format_name
上,您可能可以只需输入:Rh
Tab空格app
Tab#
Control-R Control-W (请参阅 :help c_CTRL-R_CTRL-W)。I think that is a limitation of
rails.vim
. It does not support “finding” bare methods. Supporting something like that would require one of the following:(which could be expensive with large projects),
(e.g. Exuberant Ctags and
g
Control-]; see:help g_CTRL-]
), or(which is hard to do properly).
If you know where the method is, you can extend many of the navigation commands with a method name:
But, you do not have to type all of that in. Assuming the cursor is on
format_name
you can probably just type:Rh
Tabspaceapp
Tab#
Control-R Control-W (see :help c_CTRL-R_CTRL-W).