与其他编辑器不同,vim将复制的文本存储在自己的剪贴板中。所以,对我来说,从网页复制一些文本并将其粘贴到当前的工作文件中是非常困难的。碰巧我必须打开gedit或手动输入它。
我可以使vim粘贴从和系统的剪贴板?
与其他编辑器不同,vim将复制的文本存储在自己的剪贴板中。所以,对我来说,从网页复制一些文本并将其粘贴到当前的工作文件中是非常困难的。碰巧我必须打开gedit或手动输入它。
我可以使vim粘贴从和系统的剪贴板?
当前回答
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.
其他回答
对于一些国际键盘,您可能需要按“+空格获得a”。
所以在这种情况下,你必须按“空格+y”或“空格*y”来复制。
空格+p或者空格*p来粘贴。
有两种简单的方法。使您的文件处于插入模式和 1)按下鼠标中间的按钮(滚轮),或者 2) Ctrl + Shift + V
这将是你在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
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.
你可以通过gnome终端的快捷方式粘贴到vim中。 将文件置于插入模式并使用
Ctrl + Shift + v。
事先要记住
:set paste
避免弄乱缩进。