jade.vim (3057B)
1 " Vim syntax file 2 " Language: Jade 3 " Maintainer: Joshua Borton 4 " Credits: Tim Pope 5 " Filenames: *.jade 6 7 if exists("b:current_syntax") 8 finish 9 endif 10 11 if !exists("main_syntax") 12 let main_syntax = 'jade' 13 endif 14 15 runtime! syntax/html.vim 16 unlet! b:current_syntax 17 18 syn case match 19 20 syn cluster jadeTop contains=jadeBegin,jadeComment 21 syn match jadeBegin "^\s*\%([<>]\|&[^=~ ]\)\@!" nextgroup=jadeTag,jadeClassChar,jadeIdChar,jadePlainChar 22 syn match jadeTag "\w\+\%(:\w\+\)\=" contained contains=htmlTagName,htmlSpecialTagName nextgroup=@jadeComponent 23 syn cluster jadeComponent contains=jadeAttributes,jadeIdChar,jadeClassChar,jadePlainChar 24 syn match jadeComment ' *\/\/.*$' 25 syn region jadeAttributes matchgroup=jadeAttributesDelimiter start="(" skip=+\%(\\\\\)*\\'+ end=")" contained contains=htmlArg,jadeAttributeString,htmlEvent,htmlCssDefinition nextgroup=@jadeComponent 26 syn match jadeClassChar "\." contained nextgroup=jadeClass 27 syn match jadeIdChar "#{\@!" contained nextgroup=jadeId 28 syn match jadeClass "\%(\w\|-\)\+" contained nextgroup=@jadeComponent 29 syn match jadeId "\%(\w\|-\)\+" contained nextgroup=@jadeComponent 30 syn region jadeDocType start="^\s*!!!" end="$" 31 32 syn match jadePlainChar "\\" contained 33 syn region jadeInterpolation matchgroup=jadeInterpolationDelimiter start="#{" end="}" contains=@htmlJavaScript 34 syn match jadeInterpolationEscape "\\\@<!\%(\\\\\)*\\\%(\\\ze#{\|#\ze{\)" 35 36 syn region jadeAttributeString start=+\%(=\s*\)\@<='+ skip=+\%(\\\\\)*\\'+ end=+'+ contains=jadeInterpolation 37 syn region jadeAttributeString start=+\%(:\s*\)\@<='+ skip=+\%(\\\\\)*\\'+ end=+'+ contains=jadeInterpolation 38 syn region jadeAttributeString start=+\%(=\s*\)\@<="+ skip=+\%(\\\\\)*\\'+ end=+"+ contains=jadeInterpolation 39 syn region jadeAttributeString start=+\%(:\s*\)\@<="+ skip=+\%(\\\\\)*\\'+ end=+"+ contains=jadeInterpolation 40 41 syn region jadeJavascriptFilter matchgroup=jadeFilter start="^\z(\s*\):javascript\s*$" end="^\%(\z1 \| *$\)\@!" contains=@htmlJavaScript 42 syn region jadeMarkdownFilter matchgroup=jadeFilter start="^\z(\s*\):markdown\s*$" end="^\%(\z1 \| *$\)\@!" 43 44 syn region jadeJavascriptBlock start="^\z(\s*\)script" nextgroup=@jadeComponent,jadeError end="^\%(\z1 \| *$\)\@!" contains=@jadeTop,@htmlJavascript keepend 45 syn region jadeCssBlock start="^\z(\s*\)style" nextgroup=@jadeComponent,jadeError end="^\%(\z1 \| *$\)\@!" contains=@jadeTop,@htmlCss keepend 46 47 syn match jadeError "\$" contained 48 49 hi def link jadeTag Special 50 hi def link jadeAttributeString String 51 hi def link jadeAttributesDelimiter Identifier 52 hi def link jadeIdChar Special 53 hi def link jadeClassChar Special 54 hi def link jadeId Identifier 55 hi def link jadeClass Type 56 hi def link jadeInterpolationDelimiter Delimiter 57 hi def link jadeFilter PreProc 58 hi def link jadeDocType PreProc 59 hi def link jadeComment Comment 60 61 let b:current_syntax = "jade" 62 63 if main_syntax == "jade" 64 unlet main_syntax 65 endif