]> git.r.bdr.sh - rbdr/dotfiles/blame_incremental - vim/syntax/eco.vim
Use yellow identifiers instead of red
[rbdr/dotfiles] / vim / syntax / eco.vim
... / ...
CommitLineData
1" Vim syntax file
2" Language: eco
3" Maintainer: Jay Adkisson
4" Mostly stolen from eruby.vim
5
6if !exists("g:eco_default_subtype")
7 let g:eco_default_subtype = "html"
8endif
9
10if !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\+$')
15 endif
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
32 else
33 let b:eco_subtype = g:eco_default_subtype
34 endif
35 endif
36endif
37
38if 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
41endif
42
43syn cluster ecoRegions contains=ecoBlock,ecoExpression,ecoComment
44
45syn region ecoBlock matchgroup=ecoDelimiter start=/<%/ end=/%>/ contains=@coffeeTop containedin=ALLBUT,@ecoRegions keepend
46syn region ecoExpression matchgroup=ecoDelimiter start=/<%[=\-]/ end=/%>/ contains=@coffeeTop containedin=ALLBUT,@ecoRegions keepend
47syn region ecoComment matchgroup=ecoComment start=/<%#/ end=/%>/ contains=@coffeeTodo,@Spell containedin=ALLBUT,@ecoRegions keepend
48
49" eco features not in coffeescript proper
50syn keyword ecoEnd end containedin=@ecoRegions
51syn match ecoIndentColon /\s+\w+:/ containedin=@ecoRegions
52
53" Define the default highlighting.
54
55hi def link ecoDelimiter Delimiter
56hi def link ecoComment Comment
57hi def link ecoEnd coffeeConditional
58hi def link ecoIndentColon None
59
60let b:current_syntax = 'eco'
61
62" vim: nowrap sw=2 sts=2 ts=8: