PATCH: new eRuby syntax file

Doug Kearns dougkearns at gmail.com
Thu Aug 11 09:19:04 EDT 2005


I've added a new eRuby syntax file to the repository - to meet a feature
request in the tracker more than anything.

I don't actually use eRuby but it appears to be usable; if that's not
the case speak up. ;-)

Regards,
Doug

PS. Thanks to Michael Brailsford for writing a version of this which can
be found at http://vim.sourceforge.net/scripts/script.php?script_id=403
We haven't been able to contact him so I've written a new version with
several improvements...I think.


Index: syntax/eruby.vim
===================================================================
RCS file: syntax/eruby.vim
diff -N syntax/eruby.vim
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ syntax/eruby.vim	11 Aug 2005 09:18:15 -0000
@@ -0,0 +1,62 @@
+" Vim syntax file
+" Language:	eRuby
+" Maintainer:	Doug Kearns <djkea2 at gus.gscit.monash.edu.au>
+" Info:		$Id$
+" URL:		http://vim-ruby.sourceforge.net
+" Anon CVS:	See above site
+" Licence:	GPL (http://www.gnu.org)
+" Disclaimer:
+"    This program is distributed in the hope that it will be useful,
+"    but WITHOUT ANY WARRANTY; without even the implied warranty of
+"    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+"    GNU General Public License for more details.
+" ----------------------------------------------------------------------------
+
+" For version 5.x: Clear all syntax items
+" For version 6.x: Quit when a syntax file was already loaded
+if version < 600
+  syntax clear
+elseif exists("b:current_syntax")
+  finish
+endif
+
+if !exists("main_syntax")
+  let main_syntax = 'eruby'
+endif
+
+if version < 600
+  so <sfile>:p:h/html.vim
+  syn include @rubyTop <sfile>:p:h/ruby.vim
+else
+  runtime! syntax/html.vim
+  unlet b:current_syntax
+  syn include @rubyTop syntax/ruby.vim
+endif
+
+syn region erubyOneLiner matchgroup=erubyDelimiter start="^\s*\zs%" end="$"  contains=@rubyTop,erubyDelimiter keepend
+syn region erubyBlock    matchgroup=erubyDelimiter start="<%=\="    end="%>" contains=@rubyTop containedin=ALLBUT,erubyComment keepend 
+syn region erubyComment  matchgroup=erubyDelimiter start="<%#"      end="%>" keepend
+
+" Define the default highlighting.
+" For version 5.7 and earlier: only when not done already
+" For version 5.8 and later: only when an item doesn't have highlighting yet
+if version >= 508 || !exists("did_eruby_syntax_inits")
+  if version < 508
+    let did_ruby_syntax_inits = 1
+    command -nargs=+ HiLink hi link <args>
+  else
+    command -nargs=+ HiLink hi def link <args>
+  endif
+
+  HiLink erubyDelimiter		Delimiter
+  HiLink erubyComment		Comment
+
+  delcommand HiLink
+endif
+let b:current_syntax = "eruby"
+
+if main_syntax == 'eruby'
+  unlet main_syntax
+endif
+
+" vim: sw=2 sts=2 ts=8 ff=unix nowrap:
Index: bin/vim-ruby-install.rb
===================================================================
RCS file: /var/cvs/vim-ruby/vim-ruby/bin/vim-ruby-install.rb,v
retrieving revision 1.3
diff -u -r1.3 vim-ruby-install.rb
--- bin/vim-ruby-install.rb	8 Aug 2005 03:39:41 -0000	1.3
+++ bin/vim-ruby-install.rb	11 Aug 2005 09:18:15 -0000
@@ -23,6 +23,7 @@
   ftdetect/ruby.vim
   ftplugin/ruby.vim
   indent/ruby.vim
+  syntax/eruby.vim
   syntax/ruby.vim
 }
 # XXX: what do we do with 'filetype/filetype.vim' ???
Index: CONTRIBUTORS
===================================================================
RCS file: /var/cvs/vim-ruby/vim-ruby/CONTRIBUTORS,v
retrieving revision 1.2
diff -u -r1.2 CONTRIBUTORS
--- CONTRIBUTORS	9 Aug 2005 11:57:21 -0000	1.2
+++ CONTRIBUTORS	11 Aug 2005 09:18:15 -0000
@@ -7,6 +7,7 @@
 	Nikolai Weibull <lone-star at home.se>
 
 Other contributors:
+	Michael Brailsford <brailsmt at yahoo.com>
 	Sean Flanagan <sdflanagan at ozemail.com.au>
 	Ken Miller <ken.miller at gmail.com>
 	Hugh Sasse <hgs at dmu.ac.uk>


More information about the vim-ruby-devel mailing list