Last active
August 29, 2015 14:23
-
-
Save chalmagean/478b0f48e73eb35371e4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Find where a partial is called | |
" With no arguments it uses the current file name to do the search. | |
" You can also pass a string to search for and it will do a search for | |
" a line matching render.*<your_string> | |
function! GrepPartial(...) | |
if a:0 | |
let pattern = "render.*" . a:0 | |
else | |
let filename = substitute(expand("%:t:r:r"), "^_", "", "") | |
let pattern = "render.*" . filename | |
endif | |
execute "grep! -Re '" . pattern . "' app/views/" | |
endfunction | |
command! -nargs=? GrepPartial call GrepPartial(<args>) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment