Drastic proposal: rename eruby to rhtml to make way for an HTML free eruby filetype

Tim Pope vim-ruby-devel at tpope.info
Mon Mar 12 17:39:16 EDT 2007


On Sat, Mar 10, 2007 at 04:58:39PM +1100, Doug Kearns wrote:
> Isn't erb, along with eruby and possibly others, just an
> _implementation_ of eRuby?

I haven't managed to confirm either way with google.

> > If you want to use ERB with C, attached is a proof of concept for you
> > to try.  Drop it in ~/.vim/syntax/erb.vim.  Edit somefile.c.erb and
> > and :set ft=erb.  This syntax file looks at the filename to determine
> > what to embed.  So foo.c.erb will embed in C, foo.html.erb will embed
> > in HTML, and foo.sql.erb will embed in SQL.  In fact, this script
> > could be renamed to eruby.vim and it would more or less be a drop-in
> > replacement, rendering my original suggestion moot.
> 
> This is what I had in mind but it's more difficult to get this right
> with the ftplugins.

Yes, this is partially why I suggested a separate rhtml filetype.
Things like indenting may prove nearly impossible to hack together.
> 
> > But all the magic
> > going on in the background is probably a bad idea.  If we get rid of
> > the magic, having a file like this would still make using ERB with
> > other file types a lot easier.
> 
> I like magic. :-)

So long as it works properly.  If the one magic filetype detects the
embedded language incorrectly, it may prove difficult to override.

Perhaps we should start by making a list of common filetypes combined
with eruby, so we can see what the common cases are.  So far I have

HTML
YAML - used with ERB in Rails
C - as mentioned by Hugh Sasse

Cheers,
Tim


More information about the vim-ruby-devel mailing list