On Fri, January 21, 2011 12:33 am, Asis Hallab wrote:
> frequently I edit ERB-Files in order to render HTML, Javascrtipt or even
> R-Code.
> All these files' names terminate in '.html.erb', '.js.erb' and '.r.erb',
> respectively.
>
> Of course, I would love Vim to apply both file-types. That is HTML and
> Ruby,
> Javascript and Ruby and R and Ruby, respectively.
>
> Does anyone has an idea, how to do so?

You can simply set your filetype to both types and vim will load both
files?. You need to set your filetype to ruby.html if you want both
Ruby and HTML fileplugins to be loaded.

So I suggest you put this into your ~/.vim/filetype.vim

augroup filetypedetect
    au BufNewFile,BufRead *.html.erb set filetype=html.ruby
    au BufNewFile,BufRead *.js.erb set filetype=javascript.ruby
    au BufNewFile,BufRead *.r.erb set filetype=r.ruby
augroup end

Not sure about the filetype for R files, though.

See the help:

:h 43.2
:h new-filetype

?) I can't find it in the help rightnow.

regards,
Christian

-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to