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
//