Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Continue comments #1730

Closed
antoyo opened this issue Mar 3, 2022 · 9 comments · Fixed by #10996 or #12213
Closed

Continue comments #1730

antoyo opened this issue Mar 3, 2022 · 9 comments · Fixed by #10996 or #12213
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements

Comments

@antoyo
Copy link
Contributor

antoyo commented Mar 3, 2022

Hi.

Describe your feature request

I'd like a feature like vim's setting formatoptions=ro, that is something that will continue a comment when you press Enter in insert mode or open a new line inside a comment.

Thanks!

@seanchen1991
Copy link

This is a feature that I'm quite sorely missing. I'd love to see it get merged soon!

@antoyo
Copy link
Contributor Author

antoyo commented Dec 22, 2022

I'll see if I can cleanup this PR in January. I've been quite busy lately.

@icefoxen
Copy link

Not the same, but related: using J to join lines in comments leaves the stray comment markers in the line. So if I have:

// foo
// bar

and I hit J in normal mode I get:

// foo// bar

Interestingly, :reflow handles both cases correctly.

@dist1ll
Copy link

dist1ll commented Jul 26, 2023

A note regarding the implementation: vim also carries over the preceding whitespace of the current comment line.

/* Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do 
 * eiusmod tempor incididunt ut labore et dolore magna aliqua.
 *
 *       push   %rax
 *       jmpq   *%rax▎
 *       ▎           ^ 
 */      ^       if you press enter here
       cursor
     lands here 

This is very useful when writing comments with varying levels of indentation.

@bluthej
Copy link

bluthej commented Dec 7, 2023

I'm also very excited about this feature! Just to get an update, if I understand correctly #8664 should do the trick (at least for line comments) but it's waiting on #4718 to get merged is that right?

@the-mikedavis
Copy link
Member

Yep that's correct, we want to get in #4718 first and then look at #8664

@johnbchron
Copy link

Hey this really feels like it should be a config-switched feature, and probably disabled by default. This is a "breaking change" experience-wise, especially for people who don't want to use this feature.

(For reference, my specific use case is writing doc comments for Rust struct fields. Most of the time they're just 1 line, and then when I hit newline I have to delete the comment characters before I write the field)

@TornaxO7
Copy link
Contributor

@johnbchron I could try in the future to add a config option or this. But may I ask why you aren't satisfied by pressing Ctrl + w instead to remove the lien comment?

@johnbchron
Copy link

@TornaxO7 The point is not that I don't like it, but that it's a breaking change for user experience. For people who don't want or expect this (not just me), there's no way to go back to the previous behavior unless we add a config option. Whether or not it's on by default is a different matter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements
Projects
None yet
9 participants