[英]Copy from Ubuntu 20.04 Vim and paste to another application
It doesn't work as expected "+y
and "*y
command.它不能按预期工作"+y
和"*y
命令。
I have tried each two commands and tried ctrl + v
to another application, but nothing happened.我尝试了每两个命令并尝试ctrl + v
到另一个应用程序,但没有任何反应。
I don't know what's problem.我不知道有什么问题。
How to make vim paste from (and copy to) system's clipboard? 如何从(并复制到)系统的剪贴板制作 vim 粘贴?
How can I copy text to the system clipboard from Vim? 如何将文本从 Vim 复制到系统剪贴板?
Not only these but also lots of another Q&As.不仅是这些,还有许多其他问答。
I have tried these but still doesn't work.我已经尝试过这些,但仍然不起作用。
I'm using Windows 10. And on windows, I installed Ubuntu 20.04 and using VIM.我使用的是 Windows 10。在 Windows 上,我安装了 Ubuntu 20.04 并使用 VIM。
Result of vim --version | grep 'clip'
vim --version | grep 'clip'
结果vim --version | grep 'clip'
vim --version | grep 'clip'
is here. vim --version | grep 'clip'
在这里。 +clipboard +剪贴板
As you see, clipboard
and xterm_clipboard
option is enabled.如您所见, clipboard
和xterm_clipboard
选项已启用。
And as said another Q&A of links, I append set clipboard=unnamedplus
into my vimrc file.正如另一个链接问答所述,我将set clipboard=unnamedplus
附加到我的 vimrc 文件中。
But the result did not change.但结果并没有改变。
只需在按住 Shift 的同时借助鼠标选择要复制的文本,然后按 Ctrl + Shift + c进行复制,然后您就可以将其粘贴到任何程序之外。
As I understand you want to copy from vim in WSL to Windows.据我了解,您想从 WSL 中的 vim 复制到 Windows。 Unfortunately WSL and Windows have different clipboards, but this is solvable.不幸的是,WSL 和 Windows 有不同的剪贴板,但这是可以解决的。 For example in order to copy file contents from WSL to Windows clipboard, you need to pipe file contents to clip.exe
:例如,为了将文件内容从 WSL 复制到 Windows 剪贴板,您需要将文件内容通过管道传输到clip.exe
:
cat myfile | clip.exe
So in vim we can:所以在vim中我们可以:
:! echo
放到命令行并输入:! echo
:! echo
| clip.exe
继续在命令行中输入: | clip.exe
| clip.exe
Probably it would be useful to write some autocmd for this in vimrc.在 vimrc 中为此编写一些 autocmd 可能会很有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.