Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Whenever I select something in visual mode in Vim it automatically gets copied. It causes a problem since I have alread something in clipboard to paste in that selected text.

Is there any way to disable this?

Is this due to the fact that my xterm also has similar behaviour?

share|improve this question

migrated from Mar 16 '10 at 21:58

This question came from our site for professional and enthusiast programmers.

up vote 5 down vote accepted

This behavior can be caused if certain settings are used for a few specific options.

  • When 'clipboard' contains the autoselect setting, which it does by default under *nix (only applies for normal vim), your visual selection is stored to the * register.
  • When 'guioptions' contains the a setting, which it does by default under *nix (only applies for gvim), your visual selection is stored to the * register.

The * register is synonymous with the clipboard in Windows and the currently selected text (as in select text, then middle-click to paste) in *nix.

'mouse' can also have an effect since if it is set to a or contains both n and v then Vim will receive your mouse clicks and start a visual selection if you click & drag. The behavior of what happens with the contents of the visual selection is still handled by 'clipboard'/'guioptions' though.

Basically, if you're using *nix and the default settings for 'clipboard'/'guioptions' then "* is going to be overwritten when you make a visual selection since that follows what other *nix applications do when you select text. If you're using Windows and the options are as described, then your clipboard is going to be overwritten since "* and "+ both modify the clipboard on Windows.

share|improve this answer
That solved my problem, Thanks for such a complete answer – Yogesh Arora Mar 16 '10 at 20:52

This is Unix specific. I'm not aware of anything that you can do to change that behavior within vim.

X has the concept of a selection buffer, which is whatever text is currently selected. In addition, a gvim compiled with +xterm_clipboard supports the standard clipboard, which is used whenever you do Cut/Copy/Paste operations in most applications.

The selection buffer is accessible with "*.The clipboard is accessible with "+.

If you use the main clipboard, its contents won't change with the selection.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.