rubyFunction, rubyClass, and rubyModule no longer highlighted

Nikolai Weibull now at bitwi.se
Sun Feb 18 18:55:46 EST 2007


On 2/18/07, Tim Pope <vim-ruby-devel at tpope.info> wrote:

> A much simpler pattern (and one that actually works) is
>
> syn region  rubyFunction matchgroup=rubyControl start="\<def\>\s*"    end="\ze\%(\s\|(\|;\|$\)" oneline

Even simpler (and faster):

syn region  rubyFunction matchgroup=rubyDefine start="\<def\>\ze\s*"
 end="\ze\%([[:space:](;:#]\|$\)" oneline

When using a backtracking regex matcher (juck!), using [[:space:]]
over \s and a branch in this instance is "a lot" faster.

But why aren't we doing this with something simpler like

syn keyword rubyDefine def nextgroup=rubyFunction skipwhite skipnl
syn match rubyFunction '\h\w*'

?  That's as simple and fast as it gets, and it's more true to the
Ruby syntax, because you can write things like

def
  a
  puts 'Hi, I'm method a!'
end

  nikolai


More information about the vim-ruby-devel mailing list