3 " Maintainer: Jay Adkisson
4 " Mostly stolen from eruby.vim
6 if !exists("g:eco_default_subtype")
7 let g:eco_default_subtype = "html"
10 if !exists("b:eco_subtype")
11 let s:lines = getline(1)."\n".getline(2)."\n".getline(3)."\n".getline(4)."\n".getline(5)."\n".getline("$")
12 let b:eco_subtype = matchstr(s:lines,'eco_subtype=\zs\w\+')
13 if b:eco_subtype == ''
14 let b:eco_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.eco\)\+$','',''),'\.\zs\w\+$')
16 if b:eco_subtype == 'rhtml'
17 let b:eco_subtype = 'html'
18 elseif b:eco_subtype == 'jst'
19 let b:eco_subtype = 'html'
20 elseif b:eco_subtype == 'rb'
21 let b:eco_subtype = 'ruby'
22 elseif b:eco_subtype == 'yml'
23 let b:eco_subtype = 'yaml'
24 elseif b:eco_subtype == 'js' || b:eco_subtype == 'json'
25 let b:eco_subtype = 'javascript'
26 elseif b:eco_subtype == 'txt'
27 " Conventional; not a real file type
28 let b:eco_subtype = 'text'
29 elseif b:eco_subtype == ''
30 if exists('b:current_syntax') && b:current_syntax != ''
31 let b:eco_subtype = b:current_syntax
33 let b:eco_subtype = g:eco_default_subtype
38 if exists("b:eco_subtype") && b:eco_subtype != '' && b:eco_subtype != 'eco'
39 exec "runtime! syntax/".b:eco_subtype.".vim"
40 syn include @coffeeTop syntax/coffee.vim
43 syn cluster ecoRegions contains=ecoBlock,ecoExpression,ecoComment
45 syn region ecoBlock matchgroup=ecoDelimiter start=/<%/ end=/%>/ contains=@coffeeTop containedin=ALLBUT,@ecoRegions keepend
46 syn region ecoExpression matchgroup=ecoDelimiter start=/<%[=\-]/ end=/%>/ contains=@coffeeTop containedin=ALLBUT,@ecoRegions keepend
47 syn region ecoComment matchgroup=ecoComment start=/<%#/ end=/%>/ contains=@coffeeTodo,@Spell containedin=ALLBUT,@ecoRegions keepend
49 " eco features not in coffeescript proper
50 syn keyword ecoEnd end containedin=@ecoRegions
51 syn match ecoIndentColon /\s+\w+:/ containedin=@ecoRegions
53 " Define the default highlighting.
55 hi def link ecoDelimiter Delimiter
56 hi def link ecoComment Comment
57 hi def link ecoEnd coffeeConditional
58 hi def link ecoIndentColon None
60 let b:current_syntax = 'eco'
62 " vim: nowrap sw=2 sts=2 ts=8: