1

I am running VIM 8.1 with MacVim on MacOS.

If I set clipboard+=unnamed, then when I click p in visual mode, it simply copies the currently selected text into "* and "+. If I remove this and restart vim, it works.

Any solution?

Thanks

(There are no relevant mappings by the way)

  • Please provide feedback about my answer. Did it help? If not what is lacking? – B Layer Jun 20 at 4:40
  • I have moved to neovim, so haven't checked your answer. Seems reasonable, though. – eyal karni Jun 20 at 13:34
  • If you have a chance it would helpful if you could check whether it actually solves the problem. Resolved/accepted questions/answers are much more useful to the community than those left flapping in the breeze. Thx. – B Layer Jun 30 at 19:43
2

It sounds like you have the "a" flag set in 'guioptions'. What this does is cause Vim to take control of the window manager's global selection mechanism with the effect that Visually selected text is available for pasting to other applications as well as Vim. The other effect of this flag is to associate register * with this global selection.

Anytime you make or expand a Visual selection the global selection (and register *) is updated. Combined with 'clipboard' having value "unnamed", which ties the unnamed register (") to * (and + in non-X systems), you'll see the behavior you describe: put draws from * (== the global selection == the Visual selection), with the result that the Visual selection is overwritten with itself.

See if :set guioptions-=a changes the behavior.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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