xref: /vim-8.2.3635/runtime/syntax/eruby.vim (revision bfd8fc05)
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.sourceforge.net
6" Anon CVS:	See above site
7" Licence:	GPL (http://www.gnu.org)
8" Disclaimer:
9"    This program is distributed in the hope that it will be useful,
10"    but WITHOUT ANY WARRANTY; without even the implied warranty of
11"    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12"    GNU General Public License for more details.
13
14" For version 5.x: Clear all syntax items
15" For version 6.x: Quit when a syntax file was already loaded
16if version < 600
17  syntax clear
18elseif exists("b:current_syntax")
19  finish
20endif
21
22if !exists("main_syntax")
23  let main_syntax = 'eruby'
24endif
25
26if version < 600
27  so <sfile>:p:h/html.vim
28  syn include @rubyTop <sfile>:p:h/ruby.vim
29else
30  runtime! syntax/html.vim
31  unlet b:current_syntax
32  syn include @rubyTop syntax/ruby.vim
33endif
34
35syn cluster erubyRegions contains=erubyOneLiner,erubyBlock,erubyExpression,erubyComment
36
37syn region  erubyOneLiner   matchgroup=erubyDelimiter start="^%%\@!" end="$"  contains=@rubyTop	       containedin=ALLBUT,@erubyRegions keepend oneline
38syn region  erubyBlock	    matchgroup=erubyDelimiter start="<%%\@!" end="%>" contains=@rubyTop	       containedin=ALLBUT,@erubyRegions
39syn region  erubyExpression matchgroup=erubyDelimiter start="<%="    end="%>" contains=@rubyTop	       containedin=ALLBUT,@erubyRegions
40syn region  erubyComment    matchgroup=erubyDelimiter start="<%#"    end="%>" contains=rubyTodo,@Spell containedin=ALLBUT,@erubyRegions keepend
41
42" Define the default highlighting.
43" For version 5.7 and earlier: only when not done already
44" For version 5.8 and later: only when an item doesn't have highlighting yet
45if version >= 508 || !exists("did_eruby_syntax_inits")
46  if version < 508
47    let did_ruby_syntax_inits = 1
48    command -nargs=+ HiLink hi link <args>
49  else
50    command -nargs=+ HiLink hi def link <args>
51  endif
52
53  HiLink erubyDelimiter		Delimiter
54  HiLink erubyComment		Comment
55
56  delcommand HiLink
57endif
58let b:current_syntax = "eruby"
59
60if main_syntax == 'eruby'
61  unlet main_syntax
62endif
63
64" vim: nowrap sw=2 sts=2 ts=8 ff=unix:
65