是否有任何方法复制所有行从打开的文件到VI编辑器剪贴板。我试过yG,但它没有使用剪贴板来存储这些行。
那么这可能吗?
是否有任何方法复制所有行从打开的文件到VI编辑器剪贴板。我试过yG,但它没有使用剪贴板来存储这些行。
那么这可能吗?
当前回答
我尝试了上面人们提到的一些命令。没有工作。 然后我找到了其中最简单的一个。
步骤1:vi <filename> 第二步:右键单击Putty窗口的标题栏 步骤3:选择“清除屏幕”(以避免复制SSH会话的其余部分) 第四步:再次右键单击并选择“复制所有到剪贴板”。
其他回答
如果您的手指默认使用CTRL-A CTRL-C,那么尝试从$VIMRUNTIME/mswin.vim映射。
" CTRL-C and CTRL-Insert are Copy
vnoremap <C-C> "+y
" CTRL-A is Select all
noremap <C-A> gggH<C-O>G
inoremap <C-A> <C-O>gg<C-O>gH<C-O>G
cnoremap <C-A> <C-C>gggH<C-O>G
onoremap <C-A> <C-C>gggH<C-O>G
snoremap <C-A> <C-C>gggH<C-O>G
xnoremap <C-A> <C-C>ggVG
我将它们映射到<Leader><C-a>和<Leader><C-c>。
我在PowerShell中使用Vim,当我需要将一小段代码复制到windows剪贴板时;
我使用:set nonnumber来删除行号,然后用游标和右键单击在视觉上选择代码。然后我用Ctrl + V将它粘贴到任何我想要的地方。
Use:
:%y+
扯断所有的线。
解释:
%以引用下一个命令来处理所有行 Y来拉这些线 +复制到系统剪贴板
注意:在Windows中,+和*是等价的,请看这个答案。
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会话的其余部分) 第四步:再次右键单击并选择“复制所有到剪贴板”。