Can I disable continuation of comments to the next line in Vim?
Solution 1:
I think you're looking for
:set formatoptions-=cro
From :help fo-table
:
You can use the 'formatoptions' option to influence how Vim formats text.
'formatoptions' is a string that can contain any of the letters below. The
default setting is "tcq". You can separate the option letters with commas for
readability.
letter meaning when present in 'formatoptions'
t Auto-wrap text using textwidth
c Auto-wrap comments using textwidth, inserting the current comment
leader automatically.
r Automatically insert the current comment leader after hitting
<Enter> in Insert mode.
o Automatically insert the current comment leader after hitting 'o' or
'O' in Normal mode.
...
Solution 2:
Temporarily setting the 'paste' option may do what you want, but it also disables a lot of other Vim features:
Use :set paste
to turn it on and :set nopaste
to turn it off. Alternatively, you can use :set paste!
to toggle it.
See also:
:help 'paste'
:help 'pastetoggle'
(Those commands are typed with the single-quotes.)