annotate runtime/syntax/eruby.vim @ 3848:a2fe24ec6a0d v7.3.681

updated for version 7.3.681 Problem: List of distributed files picks up backup files. Solution: Make tutor patterns more specific.
author Bram Moolenaar <bram@vim.org>
date Wed, 03 Oct 2012 21:48:43 +0200
parents dd5c1983e355
children a5352e73dc00
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
2225
dd5c1983e355 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org>
dd5c1983e355 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
4 " Last Change: 2010 Apr 15
831
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 == ''
2225
dd5c1983e355 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
25 let b:eruby_subtype = matchstr(&filetype,'^eruby\.\zs\w\+')
dd5c1983e355 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
26 endif
dd5c1983e355 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
27 if b:eruby_subtype == ''
dd5c1983e355 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
28 let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.erb\|\.eruby\|\.erubis\)\+$','',''),'\.\zs\w\+$')
1214
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
29 endif
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
30 if b:eruby_subtype == 'rhtml'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
31 let b:eruby_subtype = 'html'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
32 elseif b:eruby_subtype == 'rb'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
33 let b:eruby_subtype = 'ruby'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
34 elseif b:eruby_subtype == 'yml'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
35 let b:eruby_subtype = 'yaml'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
36 elseif b:eruby_subtype == 'js'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
37 let b:eruby_subtype = 'javascript'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
38 elseif b:eruby_subtype == 'txt'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
39 " Conventional; not a real file type
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
40 let b:eruby_subtype = 'text'
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
41 elseif b:eruby_subtype == ''
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
42 let b:eruby_subtype = g:eruby_default_subtype
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
43 endif
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
44 endif
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
45
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
46 if !exists("b:eruby_nest_level")
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
47 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
48 endif
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
49 if !b:eruby_nest_level
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
50 let b:eruby_nest_level = 1
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
51 endif
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
52
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
53 if exists("b:eruby_subtype") && b:eruby_subtype != ''
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
54 exe "runtime! syntax/".b:eruby_subtype.".vim"
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
55 unlet! b:current_syntax
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
56 endif
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
57 syn include @rubyTop syntax/ruby.vim
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
58
530
339999b511a0 updated for version 7.0148
vimboss
parents: 497
diff changeset
59 syn cluster erubyRegions contains=erubyOneLiner,erubyBlock,erubyExpression,erubyComment
339999b511a0 updated for version 7.0148
vimboss
parents: 497
diff changeset
60
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
61 exe 'syn region erubyOneLiner matchgroup=erubyDelimiter start="^%\{1,'.b:eruby_nest_level.'\}%\@!" end="$" contains=@rubyTop containedin=ALLBUT,@erubyRegions keepend oneline'
2225
dd5c1983e355 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
62 exe 'syn region erubyBlock matchgroup=erubyDelimiter start="<%\{1,'.b:eruby_nest_level.'\}%\@!-\=" end="[=-]\=%\@<!%\{1,'.b:eruby_nest_level.'\}>" contains=@rubyTop containedin=ALLBUT,@erubyRegions keepend'
dd5c1983e355 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
63 exe 'syn region erubyExpression matchgroup=erubyDelimiter start="<%\{1,'.b:eruby_nest_level.'\}=\{1,4}" end="[=-]\=%\@<!%\{1,'.b:eruby_nest_level.'\}>" contains=@rubyTop containedin=ALLBUT,@erubyRegions keepend'
dd5c1983e355 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
64 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
65
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
66 " Define the default highlighting.
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
67
2225
dd5c1983e355 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
68 hi def link erubyDelimiter PreProc
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
69 hi def link erubyComment Comment
497
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
70
1214
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
71 let b:current_syntax = 'eruby'
497
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
72
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
73 if main_syntax == 'eruby'
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
74 unlet main_syntax
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
75 endif
73f10d8124f4 updated for version 7.0136
vimboss
parents:
diff changeset
76
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
77 " vim: nowrap sw=2 sts=2 ts=8: