PATCH: highlight operators

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

PATCH: highlight operators

Doug Kearns
For those of you who've long had a burning desire for operator
highlighting, here's an initial stab at it. It's disabled by default -
define "ruby_operators" if you're interested.

What? No?...me neither. Look, it's a rainbow!

Regards,
Doug


Index: syntax/ruby.vim
===================================================================
RCS file: /var/cvs/vim-ruby/vim-ruby/syntax/ruby.vim,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -r1.85 -r1.86
--- syntax/ruby.vim 8 May 2006 06:53:23 -0000 1.85
+++ syntax/ruby.vim 8 May 2006 11:07:59 -0000 1.86
@@ -1,7 +1,7 @@
 " Vim syntax file
 " Language: Ruby
 " Maintainer: Doug Kearns <[hidden email]>
-" Info: $Id: ruby.vim,v 1.85 2006/05/08 06:53:23 dkearns Exp $
+" Info: $Id: ruby.vim,v 1.86 2006/05/08 11:07:59 dkearns Exp $
 " URL: http://vim-ruby.rubyforge.org
 " Anon CVS: See above site
 " Release Coordinator: Doug Kearns <[hidden email]>
@@ -32,6 +32,11 @@
   endif
 endif
 
+if exists("ruby_operators")
+  syn match  rubyOperator        "\%(\^\|\~\|\%(class\s*\)\@<!<<\|<=>\|<=\|\%(<\|\<class\s\+\u\w*\s*\)\@<!<[^<]\@=\|===\|==\|=\~\|!\~\|>>\|>=\|>\||\|-\|/\|\*\*\|\*\|&\|%\|+\)"
+  syn region rubyBracketOperator matchgroup=rubyOperator start="\%([_[:lower:]]\w*[?!=]\=\|}\)\@<=\[\s*" end="\s*]"
+endif
+
 " Expression Substitution and Backslash Notation
 syn match rubyEscape "\\\\\|\\[abefnrstv]\|\\\o\{1,3}\|\\x\x\{1,2}" contained display
 syn match rubyEscape "\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)" contained display
@@ -71,7 +76,11 @@
 syn match  rubySymbol ":\@<!:\$\%(-.\|[`~<=>_,;:!?/.'"@$*\&+0]\)"
 syn match  rubySymbol ":\@<!:\%(\$\|@@\=\)\=\h\w*[?!=]\="
 syn region rubySymbol start=":\@<!:\"" end="\"" skip="\\\\\|\\\""
-syn match  rubyBlockParameter "\%(\%(\<do\>\|{\)\s*\)\@<=|\s*\zs[( ,a-zA-Z0-9_*)]\+\ze\s*|" display
+if exists("ruby_operators")
+  syn match  rubyBlockParameter "\%(\%(\%(\<do\>\|{\)\s*\)|\s*\)\@<=[( ,a-zA-Z0-9_*)]\+\%(\s*|\)\@=" display
+else
+  syn match  rubyBlockParameter "\%(\%(\<do\>\|{\)\s*\)\@<=|\s*\zs[( ,a-zA-Z0-9_*)]\+\ze\s*|" display
+endif
 
 syn match rubyPredefinedVariable #$[!$&"'*+,./0:;<=>?@\`~1-9]#
 syn match rubyPredefinedVariable "$_\>"   display
_______________________________________________
vim-ruby-devel mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/vim-ruby-devel
Reply | Threaded
Open this post in threaded view
|

Re: PATCH: highlight operators

Gavin Sinclair
On 5/9/06, Doug Kearns <[hidden email]> wrote:
> For those of you who've long had a burning desire for operator
> highlighting, here's an initial stab at it. It's disabled by default -
> define "ruby_operators" if you're interested.
>
> What? No?...me neither. Look, it's a rainbow!
>

Too much time on your hands...?

I haven't configured _any_ syntax highlighting before, but I'm curious
to see what this one looks like :)

Gavin

_______________________________________________
vim-ruby-devel mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/vim-ruby-devel
Reply | Threaded
Open this post in threaded view
|

Re: PATCH: highlight operators

Doug Kearns
On Thu, May 11, 2006 at 05:38:24PM +1000, Gavin Sinclair wrote:
> On 5/9/06, Doug Kearns <[hidden email]> wrote:
> > For those of you who've long had a burning desire for operator
> > highlighting, here's an initial stab at it. It's disabled by default -
> > define "ruby_operators" if you're interested.
> >
> > What? No?...me neither. Look, it's a rainbow!
> >
>
> Too much time on your hands...?

'Feature' request...believe it or not. We can't have disgruntled users
can we? ;-)
 
<snip>

Regards,
Doug
_______________________________________________
vim-ruby-devel mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/vim-ruby-devel