Skip to content

Instantly share code, notes, and snippets.

@dbankier
Last active December 14, 2015 08:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dbankier/5060672 to your computer and use it in GitHub Desktop.
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)
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
@dbankier
Copy link
Author

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