与其他编辑器不同,vim将复制的文本存储在自己的剪贴板中。所以,对我来说,从网页复制一些文本并将其粘贴到当前的工作文件中是非常困难的。碰巧我必须打开gedit或手动输入它。
我可以使vim粘贴从和系统的剪贴板?
与其他编辑器不同,vim将复制的文本存储在自己的剪贴板中。所以,对我来说,从网页复制一些文本并将其粘贴到当前的工作文件中是非常困难的。碰巧我必须打开gedit或手动输入它。
我可以使vim粘贴从和系统的剪贴板?
当前回答
你真正需要的是EasyClip。它会做到这一点,还有更多……
其他回答
我尝试了上面的建议,但没有一个在我的环境中起作用。(Windows PuTTY通过ssh克隆)
你还可以在谷歌上搜索到: https://unix.stackexchange.com/questions/110684/copy-paste-into-sshd-vim-from-local-windows-clipboard
其中一条评论建议使用SHIFT+INSERT,它可以从我的桌面剪贴板粘贴到Vim的缓冲区中。Ctrl-C已经开始从Vim复制到桌面的剪贴板。
值得一提的是,在OSX上使用Vim,你可以用鼠标选择文本,用Cmd-C复制到OSX系统的剪贴板中,复制的文本将在Vim之外的剪贴板中可用。
换句话说,OSX把它当作一个普通的窗口,这就是饱受诟病的苹果“命令”按钮派上用场的地方。
B-30
复制到操作系统剪贴板
在可视模式下选择文本,按“*y”
从操作系统剪贴板粘贴
按“* p
你可以通过gnome终端的快捷方式粘贴到vim中。 将文件置于插入模式并使用
Ctrl + Shift + v。
事先要记住
:set paste
避免弄乱缩进。
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.