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 45syn region hamlErbInterpolation matchgroup=hamlInterpolationDelimiter start="<%[=-]\=" end="-\=%>" contained contains=@hamlRubyTop 46 47syn match hamlHelper "\<action_view?\|\.\@<!\<\%(flatten\|open\|puts\)" contained containedin=@hamlEmbeddedRuby,@hamlRubyTop,rubyInterpolation 48syn 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 49 50syn cluster hamlHtmlTop contains=@htmlTop,htmlBold,htmlItalic,htmlUnderline 51syn region hamlPlainFilter matchgroup=hamlFilter start="^\z(\s*\):\%(plain\|preserve\|erb\|redcloth\|textile\|markdown\)\s*$" end="^\%(\z1 \)\@!" contains=@hamlHtmlTop,rubyInterpolation 52syn region hamlEscapedFilter matchgroup=hamlFilter start="^\z(\s*\):\%(escaped\)\s*$" end="^\%(\z1 \)\@!" contains=rubyInterpolation 53syn region hamlErbFilter matchgroup=hamlFilter start="^\z(\s*\):erb\s*$" end="^\%(\z1 \)\@!" contains=@hamlHtmlTop,hamlErbInterpolation 54syn region hamlRubyFilter matchgroup=hamlFilter start="^\z(\s*\):ruby\s*$" end="^\%(\z1 \)\@!" contains=@hamlRubyTop 55syn region hamlSassFilter matchgroup=hamlFilter start="^\z(\s*\):sass\s*$" end="^\%(\z1 \)\@!" contains=@hamlSassTop 56 57syn region hamlJavascriptBlock start="^\z(\s*\)%script" nextgroup=@hamlComponent,hamlError end="^\%(\z1 \)\@!" contains=@hamlTop,@htmlJavaScript keepend 58syn region hamlCssBlock start="^\z(\s*\)%style" nextgroup=@hamlComponent,hamlError end="^\%(\z1 \)\@!" contains=@hamlTop,@htmlCss keepend 59syn match hamlError "\$" contained 60 61syn region hamlComment start="^\z(\s*\)-#" end="^\%(\z1 \)\@!" contains=rubyTodo 62syn region hamlHtmlComment start="^\z(\s*\)/" end="^\%(\z1 \)\@!" contains=@hamlTop,rubyTodo 63syn match hamlIEConditional "\%(^\s*/\)\@<=\[if\>[^]]*]" contained containedin=hamlHtmlComment 64 65hi def link hamlSelfCloser Special 66hi def link hamlDespacer Special 67hi def link hamlClassChar Special 68hi def link hamlIdChar Special 69hi def link hamlTag Special 70hi def link hamlClass Type 71hi def link hamlId Identifier 72hi def link hamlPlainChar Special 73hi def link hamlInterpolatableChar hamlRubyChar 74hi def link hamlRubyOutputChar hamlRubyChar 75hi def link hamlRubyChar Special 76hi def link hamlInterpolationDelimiter Delimiter 77hi def link hamlDocType PreProc 78hi def link hamlFilter PreProc 79hi def link hamlAttributesDelimiter Delimiter 80hi def link hamlObjectDelimiter Delimiter 81hi def link hamlHelper Function 82hi def link hamlHtmlComment hamlComment 83hi def link hamlComment Comment 84hi def link hamlIEConditional SpecialComment 85hi def link hamlError Error 86 87let b:current_syntax = "haml" 88 89" vim:set sw=2: 90