-
Notifications
You must be signed in to change notification settings - Fork 121
Using vim and vim-rails with Packwerk #422
We have started using Packwerk in our project, but now my vim-rails plugin doesn't work very well as it only tracks one pack at a time (e.g. the gf command). Also, my silver searcher (Ag) now has limited usefulness as there are many app and spec directories.
We have one top-level foundation pack (packs/foundation) and a number of other project packs (packs/project_group/project). Has anyone had luck guiding vim as to your directory structure?
All reactions
Replies: 1 comment
From vim-rails FAQ section:
Can I use rails.vim to edit Rails engines?
It's not supported, but if you touch config/environment.rb in the root of the engine, things should mostly work.
The Rails application detection logic indeed relies on the file to exist. Following Tim's answer above, in a Rails app with a bunch of top-level packs, I created a blank config/environment.rb file in a pack and changed directory to the pack before starting vim for different vim-rails commands like :A to work. I wasn't able to get gf to work on a class the pack definitely contained.
Maybe a command to dynamically set the b:rails_root variable depending on the current active buffer could be a workaround?