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

后端 未结 9 1146
别那么骄傲
别那么骄傲 2020-12-23 14:35

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

9条回答
  •  心在旅途
    2020-12-23 15:17

    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.

提交回复
热议问题