Created
February 12, 2013 13:48
-
-
Save davejachimiak/4769993 to your computer and use it in GitHub Desktop.
Mappings for opening related js.coffee file in rails.
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
" ... | |
function! OpenRelatedCoffeeFile(action) | |
let action = a:action | |
if match(expand('%'), 'app/assets') != -1 | |
exec action . " " . expand("%:s?app/assets?spec?:s?.js.coffee?_spec.js.coffee?") | |
else | |
exec action . " " . expand("%:s?^spec?app/assets?:s?_spec??") | |
endif | |
endfunction | |
map <Leader>jv :call OpenRelatedCoffeeFile(":vsplit")<cr> | |
map <Leader>js :call OpenRelatedCoffeeFile(":split")<cr> | |
map <Leader>je :call OpenRelatedCoffeeFile(":e")<cr> | |
" ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment