Skip to content

Instantly share code, notes, and snippets.

Last active December 14, 2015 08:49
What would you like to do?
Vim and TiAlloy: automatically open view and styles when opening controller (plus other styling)
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
if has('autocmd')
au BufRead *.tss set filetype=javascript
au BufRead */controllers/*.js call OpenAlloy()
au BufRead *.jmk set filetype=javascript
Copy link

Updated so it works with widget controllers.
I'm using jade views. Change line 2 for xml...

Copy link

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