When i copy lines likes the ones below to vim

" OmniCppComplete
let OmniCpp_NamespaceSearch = 1
let OmniCpp_GlobalScopeSearch = 1
let OmniCpp_ShowAccess = 1

Vim automagically adds " to all lines. How do i get rid of this and have it paste as it is?

In Vim

 66     " OmniCppComplete
 67     " let OmniCpp_NamespaceSearch = 1
 68     " let OmniCpp_GlobalScopeSearch = 1
 69     " let OmniCpp_ShowAccess = 1

Thanks

share|improve this question
up vote 70 down vote accepted

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.
share|improve this answer
    
+1 I tried to make formatting a bit clearer (the literal quotations were glueing together on my end) – sehe Oct 12 '11 at 7:43
11  
Only the :set paste part worked for me (vim running on an Ubuntu box through a SSH connection from mac iTerm2 without X, hence probably no clipboard on the server side). – Calimo Jun 18 '13 at 16:38
1  
I don't understand "+p at all, but the :set paste method was perfect. – Jake Apr 13 '14 at 19:23
1  
@Jake No, I really do mean the literal three keystrokes. You should see "+ in the status line after the first two, then the p will paste. If nothing happens, it's because vim can't see your OS clipboard. – Jefromi Apr 14 '14 at 3:24
1  
K. Well you can see I am no expert on Vim. Likely, as you say, my clipboard wasn't visible. Thanks for the help. The other method worked great. I still need to learn more. Vim is a such a powerful tool. – Jake Apr 14 '14 at 13:29

on vim go to the mode :set paste then press ctrl+shift+v it would work. Don't paste by going to edit and paste. It wont works

share|improve this answer
1  
I was ssh'ing from mac to a remote ubuntu. It worked, but I had to enter insert mode in between the two commands – Paschalis May 7 '15 at 12:16

when you are working on vim in UI. go to Terminal->Reset and clear then try to past the code that you have.

It would get pasted as it is.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.