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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With