1668
|
1 " Vim syntax file
|
2415
|
2 " Language: Haml
|
|
3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
|
4 " Filenames: *.haml
|
|
5 " Last Change: 2010 Jul 26
|
1668
|
6
|
|
7 if exists("b:current_syntax")
|
|
8 finish
|
|
9 endif
|
|
10
|
|
11 if !exists("main_syntax")
|
|
12 let main_syntax = 'haml'
|
|
13 endif
|
|
14 let b:ruby_no_expensive = 1
|
|
15
|
|
16 runtime! syntax/html.vim
|
|
17 unlet! b:current_syntax
|
|
18 silent! syn include @hamlSassTop syntax/sass.vim
|
|
19 unlet! b:current_syntax
|
|
20 syn include @hamlRubyTop syntax/ruby.vim
|
|
21
|
|
22 syn case match
|
|
23
|
2202
|
24 syn region rubyCurlyBlock start="{" end="}" contains=@hamlRubyTop contained containedin=rubyInterpolation
|
|
25 syn cluster hamlRubyTop add=rubyCurlyBlock
|
|
26
|
|
27 syn cluster hamlComponent contains=hamlAttributes,hamlAttributesHash,hamlClassChar,hamlIdChar,hamlObject,hamlDespacer,hamlSelfCloser,hamlRuby,hamlPlainChar,hamlInterpolatable
|
|
28 syn cluster hamlEmbeddedRuby contains=hamlAttributesHash,hamlObject,hamlRuby,hamlRubyFilter
|
1668
|
29 syn cluster hamlTop contains=hamlBegin,hamlPlainFilter,hamlRubyFilter,hamlSassFilter,hamlComment,hamlHtmlComment
|
|
30
|
2202
|
31 syn match hamlBegin "^\s*\%([<>]\|&[^=~ ]\)\@!" nextgroup=hamlTag,hamlClassChar,hamlIdChar,hamlRuby,hamlPlainChar,hamlInterpolatable
|
1668
|
32
|
2415
|
33 syn match hamlTag "%\w\+\%(:\w\+\)\=" contained contains=htmlTagName,htmlSpecialTagName nextgroup=@hamlComponent
|
2202
|
34 syn region hamlAttributes matchgroup=hamlAttributesDelimiter start="(" end=")" contained contains=htmlArg,hamlAttributeString,hamlAttributeVariable,htmlEvent,htmlCssDefinition nextgroup=@hamlComponent
|
|
35 syn region hamlAttributesHash matchgroup=hamlAttributesDelimiter start="{" end="}" contained contains=@hamlRubyTop nextgroup=@hamlComponent
|
|
36 syn region hamlObject matchgroup=hamlObjectDelimiter start="\[" end="\]" contained contains=@hamlRubyTop nextgroup=@hamlComponent
|
1668
|
37 syn match hamlDespacer "[<>]" contained nextgroup=hamlDespacer,hamlSelfCloser,hamlRuby,hamlPlainChar,hamlInterpolatable
|
|
38 syn match hamlSelfCloser "/" contained
|
|
39 syn match hamlClassChar "\." contained nextgroup=hamlClass
|
2202
|
40 syn match hamlIdChar "#{\@!" contained nextgroup=hamlId
|
1668
|
41 syn match hamlClass "\%(\w\|-\)\+" contained nextgroup=@hamlComponent
|
|
42 syn match hamlId "\%(\w\|-\)\+" contained nextgroup=@hamlComponent
|
|
43 syn region hamlDocType start="^\s*!!!" end="$"
|
|
44
|
2202
|
45 syn region hamlRuby matchgroup=hamlRubyOutputChar start="[!&]\==\|\~" skip=",\s*$" end="$" contained contains=@hamlRubyTop keepend
|
|
46 syn region hamlRuby matchgroup=hamlRubyChar start="-" skip=",\s*$" end="$" contained contains=@hamlRubyTop keepend
|
1668
|
47 syn match hamlPlainChar "\\" contained
|
2202
|
48 syn region hamlInterpolatable matchgroup=hamlInterpolatableChar start="!\===\|!=\@!" end="$" keepend contained contains=hamlInterpolation,hamlInterpolationEscape,@hamlHtmlTop
|
|
49 syn region hamlInterpolatable matchgroup=hamlInterpolatableChar start="&==\|&=\@!" end="$" keepend contained contains=hamlInterpolation,hamlInterpolationEscape
|
|
50 syn region hamlInterpolation matchgroup=hamlInterpolationDelimiter start="#{" end="}" contains=@hamlRubyTop
|
|
51 syn match hamlInterpolationEscape "\\\@<!\%(\\\\\)*\\\%(\\\ze#{\|#\ze{\)"
|
1702
|
52 syn region hamlErbInterpolation matchgroup=hamlInterpolationDelimiter start="<%[=-]\=" end="-\=%>" contained contains=@hamlRubyTop
|
1668
|
53
|
2202
|
54 syn region hamlAttributeString start=+\%(=\s*\)\@<='+ skip=+\%(\\\\\)*\\'+ end=+'+ contains=hamlInterpolation,hamlInterpolationEscape
|
|
55 syn region hamlAttributeString start=+\%(=\s*\)\@<="+ skip=+\%(\\\\\)*\\"+ end=+"+ contains=hamlInterpolation,hamlInterpolationEscape
|
|
56 syn match hamlAttributeVariable "\%(=\s*\)\@<=\%(@@\=\|\$\)\=\w\+" contained
|
|
57
|
|
58 syn match hamlHelper "\<action_view?\|\<block_is_haml?\|\<is_haml?\|\.\@<!\<flatten" contained containedin=@hamlEmbeddedRuby,@hamlRubyTop,rubyInterpolation
|
|
59 syn keyword hamlHelper capture_haml escape_once find_and_preserve haml_concat haml_indent haml_tag html_attrs html_esape init_haml_helpers list_of non_haml precede preserve succeed surround tab_down tab_up page_class contained containedin=@hamlEmbeddedRuby,@hamlRubyTop,rubyInterpolation
|
1668
|
60
|
1702
|
61 syn cluster hamlHtmlTop contains=@htmlTop,htmlBold,htmlItalic,htmlUnderline
|
2202
|
62 syn region hamlPlainFilter matchgroup=hamlFilter start="^\z(\s*\):\%(plain\|preserve\|redcloth\|textile\|markdown\|maruku\)\s*$" end="^\%(\z1 \| *$\)\@!" contains=@hamlHtmlTop,rubyInterpolation
|
|
63 syn region hamlEscapedFilter matchgroup=hamlFilter start="^\z(\s*\):\%(escaped\|cdata\)\s*$" end="^\%(\z1 \| *$\)\@!" contains=rubyInterpolation
|
|
64 syn region hamlErbFilter matchgroup=hamlFilter start="^\z(\s*\):erb\s*$" end="^\%(\z1 \| *$\)\@!" contains=@hamlHtmlTop,hamlErbInterpolation
|
|
65 syn region hamlRubyFilter matchgroup=hamlFilter start="^\z(\s*\):ruby\s*$" end="^\%(\z1 \| *$\)\@!" contains=@hamlRubyTop
|
|
66 syn region hamlJavascriptFilter matchgroup=hamlFilter start="^\z(\s*\):javascript\s*$" end="^\%(\z1 \| *$\)\@!" contains=@htmlJavaScript,rubyInterpolation keepend
|
|
67 syn region hamlCSSFilter matchgroup=hamlFilter start="^\z(\s*\):css\s*$" end="^\%(\z1 \| *$\)\@!" contains=@htmlCss,rubyInterpolation keepend
|
|
68 syn region hamlSassFilter matchgroup=hamlFilter start="^\z(\s*\):sass\s*$" end="^\%(\z1 \| *$\)\@!" contains=@hamlSassTop
|
1668
|
69
|
2202
|
70 syn region hamlJavascriptBlock start="^\z(\s*\)%script" nextgroup=@hamlComponent,hamlError end="^\%(\z1 \| *$\)\@!" contains=@hamlTop,@htmlJavaScript keepend
|
|
71 syn region hamlCssBlock start="^\z(\s*\)%style" nextgroup=@hamlComponent,hamlError end="^\%(\z1 \| *$\)\@!" contains=@hamlTop,@htmlCss keepend
|
1668
|
72 syn match hamlError "\$" contained
|
|
73
|
2202
|
74 syn region hamlComment start="^\z(\s*\)-#" end="^\%(\z1 \| *$\)\@!" contains=rubyTodo
|
|
75 syn region hamlHtmlComment start="^\z(\s*\)/" end="^\%(\z1 \| *$\)\@!" contains=@hamlTop,rubyTodo
|
1668
|
76 syn match hamlIEConditional "\%(^\s*/\)\@<=\[if\>[^]]*]" contained containedin=hamlHtmlComment
|
|
77
|
|
78 hi def link hamlSelfCloser Special
|
|
79 hi def link hamlDespacer Special
|
|
80 hi def link hamlClassChar Special
|
|
81 hi def link hamlIdChar Special
|
|
82 hi def link hamlTag Special
|
|
83 hi def link hamlClass Type
|
|
84 hi def link hamlId Identifier
|
|
85 hi def link hamlPlainChar Special
|
|
86 hi def link hamlInterpolatableChar hamlRubyChar
|
|
87 hi def link hamlRubyOutputChar hamlRubyChar
|
|
88 hi def link hamlRubyChar Special
|
|
89 hi def link hamlInterpolationDelimiter Delimiter
|
2202
|
90 hi def link hamlInterpolationEscape Special
|
|
91 hi def link hamlAttributeString String
|
|
92 hi def link hamlAttributeVariable Identifier
|
1668
|
93 hi def link hamlDocType PreProc
|
|
94 hi def link hamlFilter PreProc
|
|
95 hi def link hamlAttributesDelimiter Delimiter
|
|
96 hi def link hamlObjectDelimiter Delimiter
|
|
97 hi def link hamlHelper Function
|
|
98 hi def link hamlHtmlComment hamlComment
|
|
99 hi def link hamlComment Comment
|
|
100 hi def link hamlIEConditional SpecialComment
|
|
101 hi def link hamlError Error
|
|
102
|
|
103 let b:current_syntax = "haml"
|
|
104
|
2202
|
105 if main_syntax == "haml"
|
|
106 unlet main_syntax
|
|
107 endif
|
|
108
|
1668
|
109 " vim:set sw=2:
|