与其他编辑器不同,vim将复制的文本存储在自己的剪贴板中。所以,对我来说,从网页复制一些文本并将其粘贴到当前的工作文件中是非常困难的。碰巧我必须打开gedit或手动输入它。
我可以使vim粘贴从和系统的剪贴板?
与其他编辑器不同,vim将复制的文本存储在自己的剪贴板中。所以,对我来说,从网页复制一些文本并将其粘贴到当前的工作文件中是非常困难的。碰巧我必须打开gedit或手动输入它。
我可以使vim粘贴从和系统的剪贴板?
当前回答
这些组合键适用于任何操作系统。
使用鼠标选择目标文本,并参考复制、剪切和粘贴的键序列。
复制:Ctrl +插入 粘贴:Shift +插入
剪切:Shift + Del 粘贴:Shift +插入
其他回答
如果你有,试着从你的vimrc中删除这个: 设置鼠标=一个
它搅乱了粘贴功能。
这些组合键适用于任何操作系统。
使用鼠标选择目标文本,并参考复制、剪切和粘贴的键序列。
复制:Ctrl +插入 粘贴:Shift +插入
剪切:Shift + Del 粘贴:Shift +插入
如果你在windows上,你想用p粘贴系统剪贴板的内容,然后输入这个命令。
:set clipboard = unnamed
这解决了我的问题。
When I use my Debian vim that is not integrated with Gnome (vim --version | grep clip # shows no clipboard support), I can copy to the clipboard after holding the Shift key and selecting the text with the mouse, just like with any other curses program. As I figured from a comment by @Conner, it's the terminal (gnome-terminal in my case) that turns off its mouse event reporting when it senses my Shift press. I guess curses-based programs can receive mouse events after sending a certain Escape sequence to the terminal.
这将是你在vimrc中为此目的需要的行:
set clipboard+=unnamed " use the clipboards of vim and win
set paste " Paste from a windows or from vim
set go+=a " Visual selection automatically copied to the clipboard