Skip to content

Instantly share code, notes, and snippets.

@malclocke
Created November 29, 2012 21:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save malclocke/4171963 to your computer and use it in GitHub Desktop.
Save malclocke/4171963 to your computer and use it in GitHub Desktop.
Vim config for Javascript spec alternates
autocmd User Rails/app/assets/javascripts/*/*.js
\ let b:rails_alternate = substitute(
\ substitute(rails#buffer().path(), 'app/assets/', 'spec/', ''),
\ '.js', '_spec.js', '')
autocmd User Rails/spec/javascripts/*/*_spec.js
\ let b:rails_alternate = substitute(
\ substitute(rails#buffer().path(), 'spec/', 'app/assets/', ''),
\ '_spec.js', '.js', '')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment