xref: /vim-8.2.3635/runtime/syntax/eruby.vim (revision 899dddf8)
1" Vim syntax file
2" Language:	eRuby
3" Maintainer:	Doug Kearns <djkea2 at gus.gscit.monash.edu.au>
4" Info:		$Id$
5" URL:		http://vim-ruby.rubyforge.org
6" Anon CVS:	See above site
7" ----------------------------------------------------------------------------
8
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
30syn 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
36
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
59" vim: nowrap sw=2 sts=2 ts=8 ff=unix:
60