Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Syntax highlight for .ejs files in vim

What is the best way to make vim highlight ejs (http://embeddedjs.com/) files? Is it possible to set up html highlight for the file in general and javascript highlight to it's parts inside <% %>? Appreciate your help!

like image 505
lyuba Avatar asked Jan 04 '11 19:01

lyuba


People also ask

How do I create a syntax highlight in vim?

After opening login.sh file in vim editor, press ESC key and type ':syntax on' to enable syntax highlighting. The file will look like the following image if syntax highlighting is on. Press ESC key and type, “syntax off” to disable syntax highlighting.

What is syntax highlighting in Vim?

VIM is an alternative and advanced version of VI editor that enables Syntax highlighting feature in VI. Syntax highlighting means it can show some parts of text in another fonts and colors. VIM doesn't show whole file but have some limitations in highlighting particular keywords or text matching a pattern in a file.


2 Answers

Here's something I whipped up today (made some modifications to the eruby script). It requires the vim-javascript plugin to be installed.

https://github.com/briancollins/vim-jst

like image 31
brian Avatar answered Sep 17 '22 01:09

brian


Credits goes to @inkedmn just wanted to point out that html binding works way better, therefore put this in your ~/.vimrc file:

au BufNewFile,BufRead *.ejs set filetype=html 
like image 84
tomaszkubacki Avatar answered Sep 21 '22 01:09

tomaszkubacki