annotate runtime/syntax/eruby.vim @ 1678:b60a569eb708 v7.2b.010

updated for version 7.2b-010
author vimboss
date Tue, 22 Jul 2008 16:58:47 +0000
parents 0b796e045c42
children 7bc41231fbc7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
497
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
1 " Vim syntax file
831
f24a95dae8ee updated for version 7.0d05
vimboss
parents: 557
diff changeset
2 " Language: eRuby
1214
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
3 " Maintainer: Tim Pope <vimNOSPAM@tpope.info>
831
f24a95dae8ee updated for version 7.0d05
vimboss
parents: 557
diff changeset
4 " Info: $Id$
f24a95dae8ee updated for version 7.0d05
vimboss
parents: 557
diff changeset
5 " URL: http://vim-ruby.rubyforge.org
f24a95dae8ee updated for version 7.0d05
vimboss
parents: 557
diff changeset
6 " Anon CVS: See above site
f24a95dae8ee updated for version 7.0d05
vimboss
parents: 557
diff changeset
7 " Release Coordinator: Doug Kearns <dougkearns@gmail.com>
497
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
8
1214
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
9 if exists("b:current_syntax")
497
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
10 finish
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
11 endif
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
12
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
13 if !exists("main_syntax")
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
14 let main_syntax = 'eruby'
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
15 endif
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
16
1214
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
17 if !exists("g:eruby_default_subtype")
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
18 let g:eruby_default_subtype = "html"
497
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
19 endif
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
20
1214
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
21 if !exists("b:eruby_subtype") && main_syntax == 'eruby'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
22 let s:lines = getline(1)."\n".getline(2)."\n".getline(3)."\n".getline(4)."\n".getline(5)."\n".getline("$")
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
23 let b:eruby_subtype = matchstr(s:lines,'eruby_subtype=\zs\w\+')
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
24 if b:eruby_subtype == ''
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
25 let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.erb\|\.eruby\)\+$','',''),'\.\zs\w\+$')
1214
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
26 endif
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
27 if b:eruby_subtype == 'rhtml'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
28 let b:eruby_subtype = 'html'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
29 elseif b:eruby_subtype == 'rb'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
30 let b:eruby_subtype = 'ruby'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
31 elseif b:eruby_subtype == 'yml'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
32 let b:eruby_subtype = 'yaml'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
33 elseif b:eruby_subtype == 'js'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
34 let b:eruby_subtype = 'javascript'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
35 elseif b:eruby_subtype == 'txt'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
36 " Conventional; not a real file type
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
37 let b:eruby_subtype = 'text'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
38 elseif b:eruby_subtype == ''
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
39 let b:eruby_subtype = g:eruby_default_subtype
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
40 endif
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
41 endif
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
42
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
43 if !exists("b:eruby_nest_level")
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
44 let b:eruby_nest_level = strlen(substitute(substitute(substitute(expand("%:t"),'@','','g'),'\c\.\%(erb\|rhtml\)\>','@','g'),'[^@]','','g'))
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
45 endif
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
46 if !b:eruby_nest_level
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
47 let b:eruby_nest_level = 1
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
48 endif
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
49
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
50 if exists("b:eruby_subtype") && b:eruby_subtype != ''
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
51 exe "runtime! syntax/".b:eruby_subtype.".vim"
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
52 unlet! b:current_syntax
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
53 endif
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
54 syn include @rubyTop syntax/ruby.vim
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
55
530
339999b511a0 updated for version 7.0148
vimboss
parents: 497
diff changeset
56 syn cluster erubyRegions contains=erubyOneLiner,erubyBlock,erubyExpression,erubyComment
339999b511a0 updated for version 7.0148
vimboss
parents: 497
diff changeset
57
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
58 exe 'syn region erubyOneLiner matchgroup=erubyDelimiter start="^%\{1,'.b:eruby_nest_level.'\}%\@!" end="$" contains=@rubyTop containedin=ALLBUT,@erubyRegions keepend oneline'
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
59 exe 'syn region erubyBlock matchgroup=erubyDelimiter start="<%\{1,'.b:eruby_nest_level.'\}%\@!-\=" end="-\=%\@<!%\{1,'.b:eruby_nest_level.'\}>" contains=@rubyTop containedin=ALLBUT,@erubyRegions keepend'
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
60 exe 'syn region erubyExpression matchgroup=erubyDelimiter start="<%\{1,'.b:eruby_nest_level.'\}=" end="-\=%\@<!%\{1,'.b:eruby_nest_level.'\}>" contains=@rubyTop containedin=ALLBUT,@erubyRegions keepend'
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
61 exe 'syn region erubyComment matchgroup=erubyDelimiter start="<%\{1,'.b:eruby_nest_level.'\}#" end="-\=%\@<!%\{1,'.b:eruby_nest_level.'\}>" contains=rubyTodo,@Spell containedin=ALLBUT,@erubyRegions keepend'
497
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
62
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
63 " Define the default highlighting.
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
64
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
65 hi def link erubyDelimiter Delimiter
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
66 hi def link erubyComment Comment
497
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
67
1214
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
68 let b:current_syntax = 'eruby'
497
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
69
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
70 if main_syntax == 'eruby'
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
71 unlet main_syntax
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
72 endif
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
73
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
74 " vim: nowrap sw=2 sts=2 ts=8: