How to prevent vim from automatically editing the input

vim

Sometimes I copy/paste from one .cpp to another in vim, and vim, confident that it knows what I want to do better than me, edits my entry. For example, if I copy/paste this:

// A comment.
Some(code);

vim would replace it with this:

// A comment.
//    Some(code);

How do I disable that?

Best Answer

One option may be to remove the "r" formatoption, with:

:set formatoptions-=r

and also possibly other options, all of which I found at: https://vi.stackexchange.com/questions/1983/how-can-i-get-vim-to-stop-putting-comments-in-front-of-new-lines