为什么在 Vim 的插入模式下粘贴一个长的单行代码很慢? [英] Why is pasting a long one-liner very slow in Vim's insert mode?

查看:61
本文介绍了为什么在 Vim 的插入模式下粘贴一个长的单行代码很慢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

昨天我的 Macbook 卡住了,当时我试图将 1200 行 80 个字符的行粘贴到 Vim.下载文件要快得多,而不是粘贴文本.

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.

推荐答案

如果您将其粘贴到终端窗口中,Vim 会认为您正在手动输入它,并且会在您输入时尝试更新显示.您可以使用 pbpastepbcopy 命令访问剪贴板(在 OS X 上),因此您可以在 Vim 中执行此操作:

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

或在外壳中:

bash$ pbpaste | vim -

如果您使用的是 GUI 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

粘贴到终端窗口通常是个坏主意,请尽量使用 pbpaste.

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

这篇关于为什么在 Vim 的插入模式下粘贴一个长的单行代码很慢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆