是否有任何方法复制所有行从打开的文件到VI编辑器剪贴板。我试过yG,但它没有使用剪贴板来存储这些行。
那么这可能吗?
是否有任何方法复制所有行从打开的文件到VI编辑器剪贴板。我试过yG,但它没有使用剪贴板来存储这些行。
那么这可能吗?
当前回答
我在PowerShell中使用Vim,当我需要将一小段代码复制到windows剪贴板时;
我使用:set nonnumber来删除行号,然后用游标和右键单击在视觉上选择代码。然后我用Ctrl + V将它粘贴到任何我想要的地方。
其他回答
剪贴板为buffer +。要复制到剪贴板,请执行“+y和[移动]”。
gg"+yG会复制整个文件。
类似地,要从剪贴板粘贴,“+p
非常简单的办法:
如果你在Windows中,想要将整个文本复制到本地剪贴板,而不是你正在使用的远程服务器缓冲区,不需要任何额外的工具,只需:
放大,在屏幕上看到整个文件文本 用鼠标选择它们,然后右击复制到您的本地剪贴板
注1:现在在许多终端(如窗口终端)上,你可以用ctrl++/ctrl+-放大/缩小,用ctrl+0重置缩放大小
注2:如果你的vim是编号文件行,你可以:设置nonnumber
gVim:
:set go=a
ggVG
看:help go-a:
'a' Autoselect: If present, then whenever VISUAL mode is started,
or the Visual area extended, Vim tries to become the owner of
the windowing system's global selection. This means that the
Visually highlighted text is available for pasting into other
applications as well as into Vim itself. When the Visual mode
ends, possibly due to an operation on the text, or when an
application wants to paste the selection, the highlighted text
is automatically yanked into the "* selection register.
Thus the selection is still available for pasting into other
applications after the VISUAL mode has ended.
If not present, then Vim won't become the owner of the
windowing system's global selection unless explicitly told to
by a yank or delete operation for the "* register.
The same applies to the modeless selection.
我尝试了上面人们提到的一些命令。没有工作。 然后我找到了其中最简单的一个。
步骤1:vi <filename> 第二步:右键单击Putty窗口的标题栏 步骤3:选择“清除屏幕”(以避免复制SSH会话的其余部分) 第四步:再次右键单击并选择“复制所有到剪贴板”。
好吧,所有这些方法都很有趣,但是作为一个懒惰的程序员,我使用yank所有行通过使用数字+ y的组合
例如,你有一个总共78行的源代码文件,你可以这样做:
Gg获取第一行的游标 插入78 + y—>它在你的光标和当前行下面拉78行