Although :pastetoggle
or :paste
and :nopaste
should be working fine (if implemented - they are not always as we can see from the discussion) I highly recomment pasting using the direct approach "+p
or "*p
and reading with "+r
or "*r
:
Vim has acess to ten types of registers (:help registers
) and the questioner is interested in quotestar
and quoteplus
from section
- Selection and drop registers
"*
,"+
and "~Use these registers for storing and retrieving the selected text for the GUI. See
quotestar
andquoteplus
. 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.
:help x11-selection
further clarifies the difference of *
and +
:
quoteplus quote+
There are three documented X selections: PRIMARY (which is expected to represent the current visual selection - as in Vim's Visual mode), SECONDARY (which is ill-defined) and CLIPBOARD (which is expected to be used for cut, copy and paste operations).
Of these three, Vim uses PRIMARY when reading and writing the "* register (hence when the X11 selections are available, Vim sets a default value for 'clipboard' of "autoselect"), and CLIPBOARD when reading and writing the "+ register. Vim does not access the SECONDARY selection.
Examples: (assuming the default option values)
Select an URL in Visual mode in Vim. Go to your browser and click the middle mouse button in the URL text field. The selected text will be inserted (hopefully!). Note: in Firefox you can set the middlemouse.contentLoadURL preference to true in about:config, then the selected URL will be used when pressing middle mouse button in most places in the window.
Select some text in your browser by dragging with the mouse. Go to Vim and press the middle mouse button: The selected text is inserted.
- Select some text in Vim and do "+y. Go to your browser, select some text in a textfield by dragging with the mouse. Now use the right mouse button and select "Paste" from the popup menu. The selected text is overwritten by the text from Vim. Note that the text in the "+ register remains available when making a Visual selection, which makes other text available in the "* register. That allows overwriting selected text.