ANN: New stable release - 2005.10.05
hgs at dmu.ac.uk
Thu Oct 6 09:22:53 EDT 2005
On Thu, 6 Oct 2005, Doug Kearns wrote:
> G'day Hugh,
> On Thu, Oct 06, 2005 at 12:52:48AM +0100, Hugh Sasse wrote:
>> 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
> Yes. I fixed this on 16/09/05. Have you not picked up the change as part
> of the past few releases?
Well, I've not kept up with all the mods to CVS, but on my Unix box
that is right, on the XP box I tested last night it isn't. Which is
odd, because I re-installed gvim-6.3 from cold and then added the
new ruby vim files.
OK, I don't know what happened, but I'm now convinced that it was
something I've botched because your distro for October 5th has filetype,
not setf. I've just checked that to be certain. Some gremlin
somewhere, and since I was doing this after midnight, the metaphor
>> 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.
> Yes, that's my understanding as well. This should be working with the
> current release.
I'm sure I've botched this now, but I've not figured out how yet.
>> .erb doesn't seem to be allocated to anything else.
> I've left this out for the moment since I want to detect the 'host'
> language for these *.erb files. From my initial investigations it
Good point, but I'm not sure if 2 languages are supported...
> appears that it's safe enough to assume that *.rhtml is simply (X)HTML
> with embedded Ruby. However, *.erb could be anything so I've decided to
> just handle the *.rhtml files for now.
> Do you think we should include it for 6.4; especially if the behaviour
> is going to change? I'm assuming, at the moment, the biggest users of
What is going to change about it? I'm not fully up to date with vim
activities (and am hoping for some speed improvements in 6.4 but am
not sure how to lookup if they will happen)
> this eRuby support will be/are RoRs people who seem to use *.rhtml
> exclusively. I'm not sure users who are using *.erb files for other
> purposes will be too keen on having them open up with HTML highlighting.
OOPS! Yes erb files need their own entry, then.
>> What I can't figure out is whether one can properly support two
>> syntaxes at the same time as per my statement in  above.
> It should be possible to dynamically merge them, in much the same way as
> the existing eruby syntax file does, provided we can determine the host
> filetype for non-HTML hosted eRuby files.
> If the file is named *.erb we'd need some way to determine the host
Yes, which scripts.vim does when setf is used. As far as I can tell
from fiddling with setf vs set filetype, and from the docs. With so
much happening at startup I don't pretend to fully understand the
> If the file is named as per usual then we'd need some way to specify
> that it contains eRuby? We could add a script to ftdetect/ruby.vim which
> simply looks for <% %> regions.
Except that PHP uses those as well. Will Ruby and PHP ever bang
into eachother in a file? Maybe someone is using ERB to do code
generation for PHP. [I'm glad I'm not, the escaping would be a
nightmare in itself.]
> Then we'd need to think about merging ftplugins etc. This still isn't
> quite right for *.rhtml yet either.
It is certainly tricky.
>> 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.]
> Yes, eRuby seems like a reasonable templating solution so I expect that
> its uses are varied.
>> 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?
> "C++" - actually in quotes should work.
More information about the vim-ruby-devel