]> git.r.bdr.sh - rbdr/dotfiles/blame - vim/syntax/mustache.vim
Turn off the blur
[rbdr/dotfiles] / vim / syntax / mustache.vim
CommitLineData
0d23b6e5
BB
1" Vim syntax file
2" Language: Mustache
3" Maintainer: Juvenn Woo <machese@gmail.com>
4" Screenshot: http://imgur.com/6F408
5" Version: 1
6" Last Change: 2009 Oct 15
7" Remark:
8" It lexically hilights embedded mustaches (exclusively) in html file.
9" While it was written for Ruby-based Mustache template system, it should work for Google's C-based *ctemplate* as well as Erlang-based *et*. All of them are, AFAIK, based on the idea of ctemplate.
10" References:
11" [Mustache](http://github.com/defunkt/mustache)
12" [ctemplate](http://code.google.com/p/google-ctemplate/)
13" [ctemplate doc](http://google-ctemplate.googlecode.com/svn/trunk/doc/howto.html)
14" [et](http://www.ivan.fomichev.name/2008/05/erlang-template-engine-prototype.html)
15" TODO: Feedback is welcomed.
16
17
18" Read the HTML syntax to start with
19if version < 600
20 so <sfile>:p:h/html.vim
21else
22 runtime! syntax/html.vim
23 unlet b:current_syntax
24endif
25
26if version < 600
27 syntax clear
28elseif exists("b:current_syntax")
29 finish
30endif
31
32" Standard HiLink will not work with included syntax files
33if version < 508
34 command! -nargs=+ HtmlHiLink hi link <args>
35else
36 command! -nargs=+ HtmlHiLink hi def link <args>
37endif
38
39syntax match mustacheError '}}}\?'
40syntax match mustacheInsideError '{{[{#^<>=!\/]\?' containedin=@mustacheInside
41syntax region mustacheVariable matchgroup=mustacheMarker start=/{{/ end=/}}/ containedin=@htmlMustacheContainer
42syntax region mustacheVariableUnescape matchgroup=mustacheMarker start=/{{{/ end=/}}}/ containedin=@htmlMustacheContainer
43syntax region mustacheSection matchgroup=mustacheMarker start='{{[#^/]' end=/}}/ containedin=@htmlMustacheContainer
44syntax region mustachePartial matchgroup=mustacheMarker start=/{{[<>]/ end=/}}/
45syntax region mustacheMarkerSet matchgroup=mustacheMarker start=/{{=/ end=/=}}/
46syntax region mustacheComment start=/{{!/ end=/}}/ contains=Todo containedin=htmlHead
47
48
49" Clustering
50syntax cluster mustacheInside add=mustacheVariable,mustacheVariableUnescape,mustacheSection,mustachePartial,mustacheMarkerSet
51syntax cluster htmlMustacheContainer add=htmlHead,htmlTitle,htmlString,htmlH1,htmlH2,htmlH3,htmlH4,htmlH5,htmlH6
52
53
54" Hilighting
55" mustacheInside hilighted as Number, which is rarely used in html
56" you might like change it to Function or Identifier
57HtmlHiLink mustacheVariable Number
58HtmlHiLink mustacheVariableUnescape Number
59HtmlHiLink mustachePartial Number
60HtmlHiLink mustacheSection Number
61HtmlHiLink mustacheMarkerSet Number
62
63HtmlHiLink mustacheComment Comment
64HtmlHiLink mustacheMarker Identifier
65HtmlHiLink mustacheError Error
66HtmlHiLink mustacheInsideError Error
67
68let b:current_syntax = "mustache"
69delcommand HtmlHiLink