Wednesday, December 7, 2022

Re: automatic C // comments

Reading runtime/changes.doc, I see using <Ctrl>U immediately after an indented comment line is created, undoes the auto comment and puts the cursor in the correct column for the next line.  This is likely the correct solution for me.

This is the relevant lines from the above document:

              *fo-r*
r Automatically insert the current comment leader after hitting
  <Enter> in Insert mode.
              *fo-o*
o Automatically insert the current comment leader after hitting 'o' or
  'O' in Normal mode.  In case comment is unwanted in a specific place
  use CTRL-U to quickly delete it. |i_CTRL-U|
              *fo-/*
/ When 'o' is included: do not insert the comment leader for a //
  comment after a statement, only when // is at the start of the line.

The last 3 lines looks like exactly what I was initially asking for, but I don't understand how to make that happen.
On Wednesday, December 7, 2022 at 1:36:34 PM UTC-5 rwmit...@gmail.com wrote:
Vim automatically continues comments to the next line.  I think this is coming from c.vim.  When using // comments, it'll automatically create the second line as:

some-code // my comment
                     // <ready to add next comment>

I found this article:


While it explains what adding f:// back in does, my testing doesn't seem to support my understanding and the article doesn't explain other possible options besides 'f'.  What it does seem to do is disable all auto // comments.

I _think_ what I'd like is if a line begins (other than whitespace) with a  // comment, then continue creating comments on the subsequent lines, but if a comment is preceded by code, do not auto-indent with // on the next line.

Is that possible?  Am I making sense outside my own head?

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/e139f69c-3fb5-4b4c-86da-4bc2074c3789n%40googlegroups.com.

No comments:

Post a Comment