Some regexp pattern breaks the syntax highlighting.

Morita Sho morita-pub-en at
Fri Sep 11 23:37:52 EDT 2009

Some updates:

After some investigations, I suspect that the following line in
syntax/ruby.rb is problematic.

  syn match  rubyRegexpEscape  "\\[].*?+^$|\\/(){}[]"  contained display

As far as I understand it, this matches a regexp escape character. I think the problem is
the "display" keyword. According to Vim manual:

 display							*:syn-display*

 If the "display" argument is given, this item will be skipped when the
 detected highlighting will not be displayed.  This will speed up highlighting,
 by skipping this item when only finding the syntax state for the text that is
 to be displayed.

As result, the regexp pattern \( will not be interpreted as an escaped character
if that pattern will not be displayed. Removing the "display" keyword for
rubyRegexpEscape solves the problem for me.

Morita Sho <morita-pub-en at>

More information about the vim-ruby-devel mailing list