I'm pretty new to vim and am working on a node.js project with ejs files. I have syntax highlighting turned on with syntax on in my .vimrc file. I also have an ejs file that contains JavaScript code within a tag. Here's a basic example:

<input type="text" <%- typeof due == 'undefined' ? '' : ('value="' + due + '" ') %>/>

My problem is that the <> characters that enclose the JavaScript are both highlighted in bright red. I assume this is supposed to indicate an error, but there is no error in this code. How can I let vim know that something like this is okay?

  • 3
    Are you using the html filetype, as the question tag suggests? If so, the short answer is that Vim's included html syntax file doesn't support ejs files, and you'll need to find or write one that does. You could try this one.
    – Rich
    Feb 19, 2015 at 10:48
  • I was using the html filetype. I just tried that plugin, and now vim highlights in red the outer closing bracket (>) instead of the inner one.
    – Greg
    Feb 19, 2015 at 16:51
  • Would you recommend just finding another plugin?
    – Greg
    Feb 19, 2015 at 17:09
  • 1
    That would probably be the quickest solution. ;)
    – Rich
    Feb 19, 2015 at 17:17

1 Answer 1


I ended up using this plugin, installed with Vundle using Bundle 'briancollins/vim-jst' in my .vimrc. Note for those who haven't used Vundle before, there's a bunch of other stuff you have to put in the .vimrc as well, see its github for more detail.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.