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

后端 未结 9 1119
别那么骄傲
别那么骄傲 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:07

    That is "normal". It's slow because redrawing the text thousands of times is slow.

    As you paste the long line in, it's constantly update the display (because of how vim deals with text, or how the terminal is handing vim text, I guess).

    I tried pasting the text in vim (using iTerm) and it has the same issue, it takes a while to paste. I tried :set paste and :set nowrap and still as slow. Pasting the line straight into a terminal is equally slow

    With the dpaste link you mention, there is a plain-text link, which you could just wget and edit:

    curl http://dpaste.com/115362/plain/ | vim -
    

提交回复
热议问题