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?
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
gControl–]; 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_nameyou can probably just type:RhTabspaceappTab#Control–R Control–W (see :help c_CTRL-R_CTRL-W).