tpope/vim-rails — Issue #142: Any way to define alternates for Javascript-heavy projects?
Author: backspace
Created: 2012-02-04 23:38:37+00:00
State: open

I’ve been trying out rails.vim and it’s neato, but one of the projects I’m working on is a Coffeescript/Backbone-heavy front end with minimal actual Rails code. I’m not spending much time in `app/models/person.rb`, for instance, instead I’m in in `app/assets/javascripts/models/person.js.coffee`, with corresponding a Jasmine test in `spec/javascripts/models/person_spec.js.coffee`.

(In case it’s a situation of [“files named inconsistently”](https://github.com/tpope/vim-rails/issues/66#issuecomment-847305), I tried putting the spec in `spec/assets/javascripts/models/person_spec.js.coffee` but no luck.)

I have shortcuts defined like this…

Rnavcommand bmodel app/assets/javascripts/models/ -suffix=.js.coffee -default=javascript()

… but that’s not nearly as useful as `:A` for switching between code and spec.

I know you’re not interested in adding support for non-core Rails concepts so I’m not expecting that, but is there a way I can define additional alternates? If not, I’m willing to brave the mysterious world of Vimscript to get what I need.

Thanks for this, regardless.