Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

macvim html5 syntax highlighting in erb templates

I am trying to get syntax highlighting for HTML 5 elements in erb templates working.

I have installed newest rails.vim plugin as well as html5.vim and can't seem to get it to work.

Works fine on .html files.

like image 429
chrisortman Avatar asked Jan 21 '11 22:01

chrisortman


1 Answers

First of all, just in case you are not already using it, you should install the excellent rails.vim from Tim Pope to work on Ror with Vim. (Do not hesitate to check his other plugins as well)

That being said the likely reason why you don't get the html syntax highlighting is because the file is recognized by Vim as [eruby] and not [html].

To be sure, open an erb file and type: set filetype?

It will display the type of the file as identified by Vim.

To get both eruby and html5 syntax highlighting working at once, you can open an erb file andtype:
set filetype=eruby.html

I am not sure that multiple filetypes at once are 100% supported though.

If it works, you can add the following line to your .vimrc so that the filetype html is automatically added every time you are opening an *.erb file: autocmd BufRead,BufNewFile *.erb set filetype=eruby.html

like image 59
Xavier T. Avatar answered Nov 12 '22 23:11

Xavier T.