Created
July 3, 2011 16:58
-
-
Save MSch/1062382 to your computer and use it in GitHub Desktop.
JavaScript highlighting inside underscore.js templates for vim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Add this to the bottom of your ~/.vimrc to enable jst highlighting | |
au BufNewFile,BufRead *.jst set syntax=jst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Put this file in ~/.vim/syntax/jst.vim | |
" Vim syntax file | |
" Language: Underscore.js Templates | |
" Maintainer: Martin Schuerrer, @MSch <martin@schuerrer.org> | |
" Version: 2 | |
" Last Change: 2011 Jul 3 | |
" Read the HTML syntax to start with | |
runtime! syntax/html.vim | |
unlet b:current_syntax | |
if exists("b:current_syntax") | |
finish | |
endif | |
syn region jstBlock containedin=ALL start="<%=" keepend end="%>" contains=@htmlJavaScript,htmlCssStyleComment,htmlScriptTag,@htmlPreproc | |
syn region jstBlock containedin=ALL start="<%" keepend end="%>" contains=@htmlJavaScript,htmlCssStyleComment,htmlScriptTag,@htmlPreproc | |
let b:current_syntax = "jst" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The exists conditional check is redundant because you've just unset that variable. I don't think you need lines 12 to 16 at all.