Today I Learned

A Hashrocket project

Use suffixadd to save yourself some life

I’ve been wasting a lot of my time trying to find certain backbone files lately (yes I know, coffeescript blehg).

define [
  'hbs!templates/my_template'
  'views/my_view'
], (
  Template
  MyView
) ->

I’d like to just go to the template line and type gf

So vfnegrisolo helped me out and added the following to my .vimrc.local:

autocmd BufRead,BufNewFile *.coffee set path+=app/assets/javascripts/app/

Which in coffeescript files adds the location of my backbone app. Which is great, but for some reason it wasn’t working on one of our dev machines. Luckily, with some quick googling, we were able to get to the bottom of it with suffixadd!

autocmd BufRead,BufNewFile *.coffee set suffixesadd+=.coffee,.hbs

Which searches the path with the suffix added to the search criteria as well. Which has already saved me soooo much time! Yay!!!

Every developer at Hashrocket is a Vim expert. Check out our development environment, Dotmatrix, and if you are in Chicago, come to the monthly Vim Chicago Meetup hosted at our Chicago office.