rubyFunction, rubyClass, and rubyModule no longer highlighted

Doug Kearns dougkearns at
Sun Feb 18 20:43:43 EST 2007

On Sun, Feb 18, 2007 at 04:58:41PM -0600, Tim Pope wrote:
> In the latest CVS version of syntax/ruby.vim, method, class, and
> module declarations are no longer highlighted.  This seems to be due
> to changing lines like
> syn region rubyFunction matchgroup=rubyDefine start="\<def\s\+"    end="\%(\s*\%(\s\|(\|;\|$\|#\)\)\@=" oneline
> to lines like
> syn region rubyFunction matchgroup=rubyDefine start="\<def\(\s\+\)\@="    end="\%(\s*\%(\s\|(\|;\|$\|#\)\)\@=" oneline
> Presumably, this was to allow def, etc to be highlighted before the
> following space is input.

That's a side effect but it was actually so that users who specify
background colours, other than the default, for highlight groups don't
have the whitespace picked up too.

> A much simpler pattern (and one that
> actually works) is
> syn region  rubyFunction matchgroup=rubyControl start="\<def\>\s*"    end="\ze\%(\s\|(\|;\|$\)" oneline
> I will update the syntax file to use this third form if nobody objects.

So, unfortunately, this won't work.

Just out of interest, did you specifically drop the '#' from the end
pattern?  The following is valid syntax:

def foo# a comment
> I also have a few other minor changes that make the colors easier to
> tweak (things like grouping regexps together as rubyRegexp).

Go for it! ;-)


More information about the vim-ruby-devel mailing list