In my previous Linux install, when I selected some text in visual mode (without the mouse!), it would automatically put it in my X11 clipboard. Then I could naturally paste this text anywhere else using the mouse middle button.
With my new Linux installation, this doesn't work anymore (merely selecting text in visual mode doesn't put it in X11 clipboard anymore).
How can I get this nice feature back?
(I am not interested into the "*y
or "+y
solutions, which by the way don't work on my system.)
Thanks in advance!
The visual selection (v, V, or CTRL-V) can automatically be copied to the X11 selection (* buffer).
In non-gui mode the clipboard option controls this (only supported if +xterm_clipboard appears when you type vim --version). In gui mode guioptions controls it.
This makes all Visual mode selections automatically go to the X11 primary selection:
set clipboard+=autoselect
set guioptions+=a
This turns it off:
set clipboard-=autoselect
set guioptions-=a
In vim see:
help 'clipboard'
(single quotes required)
Use:
set guioptions+=a
This works with the GUI (Gvim). Reference is at :help guioptions_a
.
*guioptions_a* *'go-a'*
'a' Autoselect: If present, then whenever VISUAL mode is started,
or the Visual area extended, Vim tries to become the owner of
the windowing system's global selection. This means that the
Visually highlighted text is available for pasting into other
applications as well as into Vim itself. When the Visual mode
ends, possibly due to an operation on the text, or when an
application wants to paste the selection, the highlighted text
is automatically yanked into the "* selection register.
Thus the selection is still available for pasting into other
applications after the VISUAL mode has ended.
If not present, then Vim won't become the owner of the
windowing system's global selection unless explicitly told to
by a yank or delete operation for the "* register.
The same applies to the modeless selection.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With