是否有任何方法复制所有行从打开的文件到VI编辑器剪贴板。我试过yG,但它没有使用剪贴板来存储这些行。
那么这可能吗?
是否有任何方法复制所有行从打开的文件到VI编辑器剪贴板。我试过yG,但它没有使用剪贴板来存储这些行。
那么这可能吗?
当前回答
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.
其他回答
如果在可视模式下使用Vim,标准的剪切和粘贴键也适用,至少在Windows中是这样。
CTRLA表示“标记整个文件”。 CTRLC表示“复制所选内容”。 ESC表示“取消选择,所以你的下一个按键不会替换整个文件:-)
至少在Ubuntu终端(Gnome)下,标准副本也可以工作(CTRLSHIFTC,尽管似乎没有一个标准的键盘快捷键用于全选(除了ALTE后面跟着a)。
下面是一个映射命令,使用CTRL+a选择所有到剪贴板:
"
" select all with control-a
"
nnoremap <C-a> ggmqvG"+y'q
将它添加到你的.vimrc,你就可以开始了…
Use:
:%y+
扯断所有的线。
解释:
%以引用下一个命令来处理所有行 Y来拉这些线 +复制到系统剪贴板
注意:在Windows中,+和*是等价的,请看这个答案。
:%y a把所有的内容放到vim的缓冲区中, 在命令模式下按下p键将会在你的光标当前所在的行之后粘贴被拖拽的内容。
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.