Last active
December 14, 2015 08:49
-
-
Save dbankier/5060672 to your computer and use it in GitHub Desktop.
Vim and TiAlloy: automatically open view and styles when opening controller (plus other styling)
This file contains hidden or 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 OpenAlloy() | |
let s:view=substitute(expand('%:r'),"controllers","views","").".jade" | |
let s:style=substitute(expand('%:r'),"controllers","styles","").".tss" | |
exec '80vsp' s:style | |
set filetype=javascript | |
exec 'sp' s:view | |
set filetype=jade | |
endfunction | |
if has('autocmd') | |
au BufRead *.tss set filetype=javascript | |
au BufRead */controllers/*.js call OpenAlloy() | |
au BufRead *.jmk set filetype=javascript | |
endif | |
Insert this between line 11 and 12 if you need it to open tabs for you:
au BufAdd */controllers/*.js tabnew
I usually just open tabs from ctrl+p when opening controllers.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated so it works with widget controllers.
I'm using jade views. Change line 2 for xml...