PATCH: eRuby highlighting improvements

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

PATCH: eRuby highlighting improvements

Doug Kearns
This adds some general improvements to the eRuby highlighting.

The highlighting of the more complex files seems to suffer from a rather
nasty 'rainbow' effect. Should we consider something like using a
different background colour for the eRuby blocks?

Regards,
Doug


Index: syntax/eruby.vim
===================================================================
RCS file: /var/cvs/vim-ruby/vim-ruby/syntax/eruby.vim,v
retrieving revision 1.3
diff -u -b -r1.3 eruby.vim
--- syntax/eruby.vim 1 Sep 2005 10:55:59 -0000 1.3
+++ syntax/eruby.vim 1 Sep 2005 15:16:24 -0000
@@ -1,7 +1,7 @@
 " Vim syntax file
 " Language: eRuby
 " Maintainer: Doug Kearns <djkea2 at gus.gscit.monash.edu.au>
-" Info: $Id: eruby.vim,v 1.3 2005/09/01 10:55:59 dkearns Exp $
+" Info: $Id$
 " URL: http://vim-ruby.sourceforge.net
 " Anon CVS: See above site
 " Licence: GPL (http://www.gnu.org)
@@ -10,7 +10,6 @@
 "    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
@@ -33,9 +32,10 @@
   syn include @rubyTop syntax/ruby.vim
 endif
 
-syn region erubyOneLiner matchgroup=erubyDelimiter start="^%"    end="$"  contains=@rubyTop,erubyDelimiter keepend oneline
-syn region erubyBlock    matchgroup=erubyDelimiter start="<%=\=" end="%>" contains=@rubyTop containedin=ALLBUT,erubyComment keepend
-syn region erubyComment  matchgroup=erubyDelimiter start="<%#"   end="%>" keepend
+syn region  erubyOneLiner   matchgroup=erubyDelimiter start="^%"  end="$"  contains=@rubyTop containedin=ALLBUT,erubyBlock,erubyComment,erubyExpression keepend oneline
+syn region  erubyBlock      matchgroup=erubyDelimiter start="<%"  end="%>" contains=@rubyTop containedin=ALLBUT,erubyBlock,erubyComment,erubyExpression
+syn region  erubyExpression matchgroup=erubyDelimiter start="<%=" end="%>" contains=@rubyTop containedin=ALLBUT,erubyComment,erubyExpression
+syn region  erubyComment    matchgroup=erubyDelimiter start="<%#" end="%>" contains=rubyTodo,@Spell containedin=ALLBUT,erubyBlock,erubyComment,erubyExpression keepend
 
 " Define the default highlighting.
 " For version 5.7 and earlier: only when not done already
Index: syntax/ruby.vim
===================================================================
RCS file: /var/cvs/vim-ruby/vim-ruby/syntax/ruby.vim,v
retrieving revision 1.68
diff -u -b -r1.68 ruby.vim
--- syntax/ruby.vim 30 Aug 2005 10:54:04 -0000 1.68
+++ syntax/ruby.vim 1 Sep 2005 15:16:27 -0000
@@ -138,6 +138,10 @@
 syn region rubyString start=+\%(\%(class\s*\|\%(\.\|::\)\)\_s*\)\@<!<<-'\z([^']*\)'\ze+hs=s+3  matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart     nextgroup=rubyFunction fold keepend
 syn region rubyString start=+\%(\%(class\s*\|\%(\.\|::\)\)\_s*\)\@<!<<-`\z([^`]*\)`\ze+hs=s+3  matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial nextgroup=rubyFunction fold keepend
 
+if exists('main_syntax') && main_syntax == 'eruby'
+  let ruby_no_expensive = 1
+end
+
 " Expensive Mode - colorize *end* according to opening statement
 if !exists("ruby_no_expensive")
   syn region rubyFunction matchgroup=rubyDefine start="\<def\s\+"    end="\ze\%(\s\|(\|;\|$\)" oneline
_______________________________________________
vim-ruby-devel mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/vim-ruby-devel