Every so often when I’m about to change a partial I need to know how this change may affect other parts of the application by seeing where and how the partial is called and used. I’ve written a Vim command to do this (put in your .vimrc):
|
Now while editing a partial just use :GrepPartial.
You can also pass in a partial:
:GrepPartial accounts/show
Note that if you have Fugitive installed then you’ll want to compile git with the PCRE library, easy for Homebrew users:
brew install git --with-pcre
If you don’t install PCRE then you’ll need to get rid of the \b, though your
results may be less accurate.
Improvements
Right now the function is good-enough for how I use it, though at some point I may automatically scope partial references when given a non-scoped partial pattern.