是否有任何方法复制所有行从打开的文件到VI编辑器剪贴板。我试过yG,但它没有使用剪贴板来存储这些行。
那么这可能吗?
是否有任何方法复制所有行从打开的文件到VI编辑器剪贴板。我试过yG,但它没有使用剪贴板来存储这些行。
那么这可能吗?
当前回答
虽然上面的许多答案都很出色,但没有一个解决方案适合我,因为我使用的是Ubuntu 16.04附带的默认VIM安装,并且默认没有安装剪贴板选项。我还想把文本粘贴到一个外部程序中。
解决方案:Ubuntu的默认终端允许你通过点击编辑然后全选来高亮显示全部内容。
其他回答
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.
我在我的.vimrc中添加了以下一行
nnoremap <F5> :%y+<CR>
这允许我通过按F5(在命令模式下)将Vim中的所有文本复制到剪贴板。
这是我所做的拉出整个文件:
ggVGy
剪贴板为buffer +。要复制到剪贴板,请执行“+y和[移动]”。
gg"+yG会复制整个文件。
类似地,要从剪贴板粘贴,“+p
在vim或它的选项卡中复制整个文件吗
y G
然后移动到一个标签和粘贴
p
并对整个文件进行删减使用
d G