1" Vim syntax file 2" Language: Haml 3" Maintainer: Tim Pope <[email protected]> 4" Filenames: *.haml 5 6if exists("b:current_syntax") 7 finish 8endif 9 10if !exists("main_syntax") 11 let main_syntax = 'haml' 12endif 13let b:ruby_no_expensive = 1 14 15runtime! syntax/html.vim 16unlet! b:current_syntax 17silent! syn include @hamlSassTop syntax/sass.vim 18unlet! b:current_syntax 19syn include @hamlRubyTop syntax/ruby.vim 20 21syn case match 22 23syn cluster hamlComponent contains=hamlAttributes,hamlClassChar,hamlIdChar,hamlObject,hamlDespacer,hamlSelfCloser,hamlRuby,hamlPlainChar,hamlInterpolatable 24syn cluster hamlEmbeddedRuby contains=hamlAttributes,hamlObject,hamlRuby,hamlRubyFilter 25syn cluster hamlTop contains=hamlBegin,hamlPlainFilter,hamlRubyFilter,hamlSassFilter,hamlComment,hamlHtmlComment 26 27syn match hamlBegin "^\s*[<>&]\@!" nextgroup=hamlTag,hamlAttributes,hamlClassChar,hamlIdChar,hamlObject,hamlRuby,hamlPlainChar,hamlInterpolatable 28 29syn match hamlTag "%\w\+" contained contains=htmlTagName,htmlSpecialTagName nextgroup=@hamlComponent 30syn region hamlAttributes matchgroup=hamlAttributesDelimiter start="{" end="}" contained contains=@hamlRubyTop nextgroup=@hamlComponent 31syn region hamlObject matchgroup=hamlObjectDelimiter start="\[" end="\]" contained contains=@hamlRubyTop nextgroup=@hamlComponent 32syn match hamlDespacer "[<>]" contained nextgroup=hamlDespacer,hamlSelfCloser,hamlRuby,hamlPlainChar,hamlInterpolatable 33syn match hamlSelfCloser "/" contained 34syn match hamlClassChar "\." contained nextgroup=hamlClass 35syn match hamlIdChar "#" contained nextgroup=hamlId 36syn match hamlClass "\%(\w\|-\)\+" contained nextgroup=@hamlComponent 37syn match hamlId "\%(\w\|-\)\+" contained nextgroup=@hamlComponent 38syn region hamlDocType start="^\s*!!!" end="$" 39 40syn region hamlRuby matchgroup=hamlRubyOutputChar start="[=~]" end="$" contained contains=@hamlRubyTop keepend 41syn region hamlRuby matchgroup=hamlRubyChar start="-" end="$" contained contains=@hamlRubyTop keepend 42syn match hamlPlainChar "\\" contained 43syn region hamlInterpolatable matchgroup=hamlInterpolatableChar start="==" end="$" keepend contained contains=hamlInterpolation 44syn region hamlInterpolation matchgroup=hamlInterpolationDelimiter start="#{" end="}" contained contains=@hamlRubyTop 45 46syn match hamlHelper "\<action_view?\|\.\@<!\<\%(flatten\|open\|puts\)" contained containedin=@hamlEmbeddedRuby,@hamlRubyTop,rubyInterpolation 47syn keyword hamlHelper capture_haml find_and_preserve html_attrs init_haml_helpers list_of preced preserve succeed surround tab_down tab_up page_class contained containedin=@hamlEmbeddedRuby,@hamlRubyTop,rubyInterpolation 48 49syn region hamlPlainFilter matchgroup=hamlFilter start="^\z(\s*\):\%(plain\|preserve\|erb\|redcloth\|textile\|markdown\)\s*$" end="^\%(\z1 \)\@!" contains=htmlTag,htmlEndTag,htmlSpecialChar,htmlComment,@htmlTop 50syn region hamlRubyFilter matchgroup=hamlFilter start="^\z(\s*\):ruby\s*$" end="^\%(\z1 \)\@!" contains=@hamlRubyTop 51syn region hamlSassFilter matchgroup=hamlFilter start="^\z(\s*\):sass\s*$" end="^\%(\z1 \)\@!" contains=@hamlSassTop 52 53syn region hamlJavascriptBlock start="^\z(\s*\)%script" nextgroup=@hamlComponent,hamlError end="^\%(\z1 \)\@!" contains=@hamlTop,@htmlJavaScript keepend 54syn region hamlCssBlock start="^\z(\s*\)%style" nextgroup=@hamlComponent,hamlError end="^\%(\z1 \)\@!" contains=@hamlTop,@htmlCss keepend 55syn match hamlError "\$" contained 56 57syn region hamlComment start="^\z(\s*\)-#" end="^\%(\z1 \)\@!" contains=rubyTodo 58syn region hamlHtmlComment start="^\z(\s*\)/" end="^\%(\z1 \)\@!" contains=@hamlTop,rubyTodo 59syn match hamlIEConditional "\%(^\s*/\)\@<=\[if\>[^]]*]" contained containedin=hamlHtmlComment 60 61hi def link hamlSelfCloser Special 62hi def link hamlDespacer Special 63hi def link hamlClassChar Special 64hi def link hamlIdChar Special 65hi def link hamlTag Special 66hi def link hamlClass Type 67hi def link hamlId Identifier 68hi def link hamlPlainChar Special 69hi def link hamlInterpolatableChar hamlRubyChar 70hi def link hamlRubyOutputChar hamlRubyChar 71hi def link hamlRubyChar Special 72hi def link hamlInterpolationDelimiter Delimiter 73hi def link hamlDocType PreProc 74hi def link hamlFilter PreProc 75hi def link hamlAttributesDelimiter Delimiter 76hi def link hamlObjectDelimiter Delimiter 77hi def link hamlHelper Function 78hi def link hamlHtmlComment hamlComment 79hi def link hamlComment Comment 80hi def link hamlIEConditional SpecialComment 81hi def link hamlError Error 82 83let b:current_syntax = "haml" 84 85" vim:set sw=2: 86