How to stop vim from inserting comment characters while pasting from the clipboard?

Two main options:

  • Put directly from the register without ever entering insert mode, using  "+p
    • " means “use the following register”;
    • + refers to the clipboard, and
    • p for put!

Should you be using the middle click selection paste in Linux, use * instead of + to refer to it.

  • Before entering insert mode to paste, run :set paste. Turn it off once you leave insert mode with :set nopaste.

Leave a Comment