ANN: New stable release - 2005.10.05

Hugh Sasse hgs at
Wed Oct 5 19:52:48 EDT 2005

On Wed, 5 Oct 2005, Doug Kearns wrote:

> I've just sent up vim-ruby-2005.10.05.

I've been trying this out and have come to the followint conclusion.

In the ftdetect files you have 
" eRuby
au BufNewFile,BufRead *.rhtml                          setf eruby

I think  that line should be:

au BufNewFile,BufRead *.rhtml,*.erb                     set ft=eruby

Normally avoiding setf would be wrong, because :he setf says it is
to prevent the filetype being set several times when sorting out the
syntax etc.  [However, ideally for eruby files you still want the
native syntax (whatever that happens to be) to still work.]  With
vim/scripts.vim there is a did_filetype() call which, unless the
filetype has been set, causes scripts.vim to exit.  Using setf
instead of set filetype means that did_filetype "thinks" filetype
has not been set, so overrides any decisions we have made up to now,
setting, in my case, the filetype straight XML by examining the
file's contents.

.erb doesn't seem to be allocated to anything else.

What I can't figure out is whether one can properly support two
syntaxes at the same time as per my statement in [] above.  Why
would you want to?  Well, see for example page 93 of "Code
Generation in Action" by Jack Herrington  [ISBN 1-930110-97-9]
(and other examples therein) where ERB is being used to generate
lots of repetitive C++ data structures.  You'd want the C++ syntax
to be correcly highlighted as well as the embedded ruby, if
possible.   [For completeness the website is at:

, but I don't see many examples of the use of eruby with C++ there.]

I'm not seeing much on the net to point you at either -- any idea
how to make Google do what we want with "C++" instead of treating it
as C?


More information about the vim-ruby-devel mailing list