Reputation: 389
I use //
to mark comments in C files, and when I reach the end of a line and press Enter, Vim helpfully inserts the //
at the beginning of the next line.
Usually that's what I want, but when I have finished inserting comments I have to delete that //
to resume typing real code. It occurs to me that there MIGHT be a way to terminate the last comment line without getting the comment continuation. Ctl-Enter, Shift-Enter, Fn-Enter don't work, and Alt-Enter takes me out of Insert mode.
Is there a way to a) remain in Insert mode, b) open a blank line below, AND c) not add the //
?
Upvotes: 0
Views: 69
Reputation: 172570
There's no built-in way, but you can surely define a custom mapping that provides this, either by using workaround command sequences (<CR><Esc>cc
, or <Esc>o
), or by temporarily changing the 'formatoptions'
option that controls this.
In terms of editing efficiency, there's not much to gain over the alternatives (I usually just press <C-u>
to clear the inserted comment prefix), so I'm not sure it's worth it.
Upvotes: 1