Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

69 lines (58 sloc) 2.671 kB
" Vim syntax file
" Language: Mustache
" Maintainer: Juvenn Woo <>
" Screenshot:
" Version: 1
" Last Change: 2009 Oct 15
" Remark:
" It lexically hilights embedded mustaches (exclusively) in html file.
" 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.
" References:
" [Mustache](
" [ctemplate](
" [ctemplate doc](
" [et](
" TODO: Feedback is welcomed.
" Read the HTML syntax to start with
if version < 600
so <sfile>:p:h/html.vim
runtime! syntax/html.vim
unlet b:current_syntax
if version < 600
syntax clear
elseif exists("b:current_syntax")
" Standard HiLink will not work with included syntax files
if version < 508
command! -nargs=+ HtmlHiLink hi link <args>
command! -nargs=+ HtmlHiLink hi def link <args>
syntax match mustacheError '}}}\?'
syntax match mustacheInsideError '{{[{#<>=!\/]\?' containedin=@mustacheInside
syntax region mustacheVariable matchgroup=mustacheMarker start=/{{/ end=/}}/ containedin=@htmlMustacheContainer
syntax region mustacheVariableUnescape matchgroup=mustacheMarker start=/{{{/ end=/}}}/ containedin=@htmlMustacheContainer
syntax region mustacheSection matchgroup=mustacheMarker start='{{[#/]' end=/}}/ containedin=@htmlMustacheContainer
syntax region mustachePartial matchgroup=mustacheMarker start=/{{[<>]/ end=/}}/
syntax region mustacheMarkerSet matchgroup=mustacheMarker start=/{{=/ end=/=}}/
syntax region mustacheComment start=/{{!/ end=/}}/ contains=Todo containedin=htmlHead
" Clustering
syntax cluster mustacheInside add=mustacheVariable,mustacheVariableUnescape,mustacheSection,mustachePartial,mustacheMarkerSet
syntax cluster htmlMustacheContainer add=htmlHead,htmlTitle,htmlString,htmlH1,htmlH2,htmlH3,htmlH4,htmlH5,htmlH6
" Hilighting
" mustacheInside hilighted as Number, which is rarely used in html
" you might like change it to Function or Identifier
HtmlHiLink mustacheVariable Number
HtmlHiLink mustacheVariableUnescape Number
HtmlHiLink mustachePartial Number
HtmlHiLink mustacheSection Number
HtmlHiLink mustacheMarkerSet Number
HtmlHiLink mustacheComment Comment
HtmlHiLink mustacheMarker Identifier
HtmlHiLink mustacheError Error
HtmlHiLink mustacheInsideError Error
let b:current_syntax = "mustache"
delcommand HtmlHiLink
Jump to Line
Something went wrong with that request. Please try again.