helix
helix copied to clipboard
Support for block comments
Add support for block comments. (line comment support per language was added in #463)
There are multiple use-cases for this:
- Many languages don't support line comments but do support block comments, e.g.
html/xml,css, oldc,ocaml. thetoggle_commentscommand could fallback to a multi-line comment. - Some users / codebases prefer line comments. That preference could be set in
languages.toml. - A comment textobject could be interesting too, to select whole comments or comment out selections.
On a related note - I won't make a new issue for this:
The :reflow command can reformat a selected part of a C block comment of the following style (in my limited testing), but unlike Vim, adding a newline while editing the comment will not add * at the line start, which is rather tedious.
/*
* foo
* bar
*/
(this was tested in a .h file with clangd configured as LSP and .h added as a C language extension)
That's https://github.com/helix-editor/helix/issues/1730
Is there currently no way to toggle comments in languages like CSS, HTML? I'm (currently) not even talking about having separate shortcuts for block comments, would just be nice if it worked at all in such languages.
Correct, this issue covers adding support for toggling block comments
this could be potentially fixed with #4718: heres a video of it in action, its still a draft though and needs a bit of work
Hi guys! I'm in love with Helix. While I'm learning to program in C, I wrote a commenting utility for Helix. For those who interested, here is the link to the repo.