Why is pasting a long one-liner very slow in Vim's insert mode?

Léo Léopold Hertz 준영 picture Léo Léopold Hertz 준영 · Feb 1, 2009 · Viewed 7.4k times · Source

My Macbook was stuck yesterday, when I tried to paste 1200 lines of 80 characters to Vim. It was much faster to download the file, and not to paste the text.

I have thought that this problem might be the reason, why internet operators allow slower uploading than downloading.

Answer

too much php picture too much php · Feb 1, 2009

If you paste it into a terminal window, Vim thinks you're typing it out by hand, and it will try and update the display as you go. You can access your clipboard (on OS X) using the pbpaste and pbcopy commands, so you can just do this in Vim:

:read !pbpaste

or in a shell:

bash$ pbpaste | vim -

If you were using GUI Vim, you would use the "* register to paste (this is what the context menu does):

"*P   <- in normal mode

Pasting into the terminal window is usually a bad idea, try and use pbpaste where you can.