terrortylor / nvim-comment

A comment toggler for Neovim, written in Lua
MIT License
479 stars 23 forks source link

Nested comments #16

Closed jghauser closed 3 years ago

jghauser commented 3 years ago

Thank you very much for your great plugin!

One thing I'm missing from tpope's plugin is how it solved nested comments. This is especially relevant for the html comments that I use in my markdown files: <!-- comment -->. The problem occurs when you have a text such as:

This is a<!-- comment --> text.

When uncommenting this it becomes:

<!--This is a<!-- comment --> text.-->

That's unexpected because the comment that begins at the beginning of the line now ends at the first -->.

Tpope's plugin solved that by converting the nested comments into <1!-- comment --1>. The text then becomes:

<!--This is a<1!-- comment --1> text.-->

This string could then of course be uncommented again as well. I'm not sure if this affects languages other than markdown.

If you think this is something that nvim-comment should know how to do, you might also want to take a look at this issue; apparently the way tpope solved it leads to some problems (though this has never affected me).

terrortylor commented 3 years ago

Hey at the moment this feature isn't on the radar, happy to take a PR though.