1

Searching for this is difficult due to the overload of the word "leader" in Vim documentation.

Here are the (hopefully relevant) settings I have now:

formatoptions=croql
comments=s1:/*,mb:*,ex:*/,://

I want Vim to insert a new comment leader (//) on each new line, whether it wraps due to textwidth (formatoptions=c) or because I hit enter (formatoptions=r), but I want Vim to remove any automatically inserted comment leader if I escape to normal mode without entering any text on the new line. So the sequence // text<Enter><Escape> from insert mode should yield this:

// text

instead of this:

// text
//
John Freeman
  • 2,552
  • 1
  • 27
  • 34
  • 1
    Do you want to keep the blank line? or remove the line completely? If you are just inserting a blank like please take a look at the following post: http://stackoverflow.com/a/16360472/438329 – Peter Rincker Oct 08 '14 at 17:13
  • 1
    Related: http://stackoverflow.com/questions/26222481/vim-remove-comment-character-after-double-enter – FDinoff Oct 08 '14 at 19:11

0 Answers0