blob: c3cc435cf9f64122e4d0347e05b78788757c7879 [file] [log] [blame]
Bram Moolenaar6e7c7f32005-08-24 22:16:11 +00001" Vim syntax file
2" Language: eRuby
3" Maintainer: Doug Kearns <djkea2 at gus.gscit.monash.edu.au>
4" Info: $Id$
Bram Moolenaara5792f52005-11-23 21:25:05 +00005" URL: http://vim-ruby.rubyforge.org
Bram Moolenaar6e7c7f32005-08-24 22:16:11 +00006" Anon CVS: See above site
Bram Moolenaara5792f52005-11-23 21:25:05 +00007" ----------------------------------------------------------------------------
Bram Moolenaar6e7c7f32005-08-24 22:16:11 +00008
9" For version 5.x: Clear all syntax items
10" For version 6.x: Quit when a syntax file was already loaded
11if version < 600
12 syntax clear
13elseif exists("b:current_syntax")
14 finish
15endif
16
17if !exists("main_syntax")
18 let main_syntax = 'eruby'
19endif
20
21if version < 600
22 so <sfile>:p:h/html.vim
23 syn include @rubyTop <sfile>:p:h/ruby.vim
24else
25 runtime! syntax/html.vim
26 unlet b:current_syntax
27 syn include @rubyTop syntax/ruby.vim
28endif
29
Bram Moolenaar60a795a2005-09-16 21:55:43 +000030syn cluster erubyRegions contains=erubyOneLiner,erubyBlock,erubyExpression,erubyComment
31
32syn region erubyOneLiner matchgroup=erubyDelimiter start="^%%\@!" end="$" contains=@rubyTop containedin=ALLBUT,@erubyRegions keepend oneline
33syn region erubyBlock matchgroup=erubyDelimiter start="<%%\@!" end="%>" contains=@rubyTop containedin=ALLBUT,@erubyRegions
34syn region erubyExpression matchgroup=erubyDelimiter start="<%=" end="%>" contains=@rubyTop containedin=ALLBUT,@erubyRegions
35syn region erubyComment matchgroup=erubyDelimiter start="<%#" end="%>" contains=rubyTodo,@Spell containedin=ALLBUT,@erubyRegions keepend
Bram Moolenaar6e7c7f32005-08-24 22:16:11 +000036
37" Define the default highlighting.
38" For version 5.7 and earlier: only when not done already
39" For version 5.8 and later: only when an item doesn't have highlighting yet
40if version >= 508 || !exists("did_eruby_syntax_inits")
41 if version < 508
42 let did_ruby_syntax_inits = 1
43 command -nargs=+ HiLink hi link <args>
44 else
45 command -nargs=+ HiLink hi def link <args>
46 endif
47
48 HiLink erubyDelimiter Delimiter
49 HiLink erubyComment Comment
50
51 delcommand HiLink
52endif
53let b:current_syntax = "eruby"
54
55if main_syntax == 'eruby'
56 unlet main_syntax
57endif
58
Bram Moolenaar60a795a2005-09-16 21:55:43 +000059" vim: nowrap sw=2 sts=2 ts=8 ff=unix: