如何将我在浏览器中复制的内容添加到我的Vim寄存器中?

时间:2015-04-14 16:27:15

标签: vim

我希望能够在我的浏览器中复制内容并将其保存在我的Vim寄存器中,以便我可以随意粘贴它们。目前,要从我的浏览器粘贴一些内容,我需要右键单击我的Vim窗口并选择“粘贴”选项。这通常会弄乱文本的对齐,并且会破坏使用Vim的整个目的。如何将我在浏览器中复制的内容添加到我的Vim寄存器中?

1 个答案:

答案 0 :(得分:1)

您应该能够使用*和/或+个寄存器。来自:help registers

7. Selection and drop registers "*, "+ and "~ 
Use these registers for storing and retrieving the selected text for the GUI.
See |quotestar| and |quoteplus|.  When the clipboard is not available or not
working, the unnamed register is used instead.  For Unix systems the clipboard
is only available when the |+xterm_clipboard| feature is present.  {not in Vi}

Note that there is only a distinction between "* and "+ for X11 systems.  For
an explanation of the difference, see |x11-selection|.  Under MS-Windows, use
of "* and "+ is actually synonymous and refers to the |gui-clipboard|.

如果您需要在插入模式下粘贴,请在粘贴之前使用:set paste,并在不再需要粘贴任何文本后使用:set nopaste。此选项将禁用许多自动格式化功能,以便在您复制时显示粘贴的文本。

相关问题