nerdcommenter icon indicating copy to clipboard operation
nerdcommenter copied to clipboard

Incorrect comments in eRuby

Open exchgr opened this issue 10 years ago • 2 comments

When commenting a line of eRuby, such as:

<%= some_var %>

nerdcommenter outputs:

<%#<%= some_var %>%>

This is invalid. I'd expect something a bit smarter, like what tpope's vim-commentary does:

<%# <%= some_var %1> %>

exchgr avatar Oct 16 '14 16:10 exchgr

Thanks for raising the issue @exchgr. I've recently been added as a maintainer to this project and am working through the backlog of issues. Unfortunately this is not going to be an easy fix. The issue above is that the language itself is ambiguous. I actually like the way @tpope handled this even though the delimiters end up being totally bogus. Unfortunately with as many other things than NERDCommenter does handle (alternate delimiters, nested comments, mix and match block vs. line syntaxes, etc.) his hack wouldn't be so easy to implement here.

I actually worked up something that would work for this case, but it creates all kinds of side effects for other languages. You can check it out in my unbalanced-nesting branch. It should do the trick as long as you don't try to uncomment lines that aren't commented.

I'm open to suggestions about how this could be implemented and would review any PR's, but I'm not sure I have the time to come up with a robust solution on my own (and I don't use ruby or anything else with ambiguous tags, so it's not really an itch for me).

alerque avatar May 24 '16 10:05 alerque

Use <leader>ca to switch to the alternative set of delimiters then you can use , I think it works. : )

RokyZevon avatar Dec 25 '16 04:12 RokyZevon