与其他编辑器不同,vim将复制的文本存储在自己的剪贴板中。所以,对我来说,从网页复制一些文本并将其粘贴到当前的工作文件中是非常困难的。碰巧我必须打开gedit或手动输入它。
我可以使vim粘贴从和系统的剪贴板?
与其他编辑器不同,vim将复制的文本存储在自己的剪贴板中。所以,对我来说,从网页复制一些文本并将其粘贴到当前的工作文件中是非常困难的。碰巧我必须打开gedit或手动输入它。
我可以使vim粘贴从和系统的剪贴板?
当前回答
复制到操作系统剪贴板
在可视模式下选择文本,按“*y”
从操作系统剪贴板粘贴
按“* p
其他回答
你真正需要的是EasyClip。它会做到这一点,还有更多……
我认为这个问题应该有一个更客观和形象的答案:
进入粘贴模式
ESC :设置粘贴 按我 SHIFT +插入(将文本复制到剪贴板上)
退出粘贴模式
ESC :设置nopaste 按我
粘贴文本后,就可以再次输入了。
Linux
在我的Linux系统上,+和*寄存器映射到一个X11选择项,可以用鼠标中间按钮粘贴。当使用:set clipboard= named和:set clipboard=unnamedplus时,寄存器映射到剪贴板,可以用CTRL-V粘贴。
具体细节似乎取决于配置和系统,所以您的里程肯定会有所不同。不过,它肯定会给你指明正确的方向。
另请参阅
http://vim.wikia.com/wiki/Accessing_the_system_clipboard
进入vim窗口后,按“I”进入插入模式。然后将光标移动到需要的位置,同时按Ctrl + Insert按钮从剪贴板粘贴。
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.