In the ~/.vimrc the clipboard has been enabled:

set clipboard=unnamed

But after hitting v for Visual

enter image description here

and then hitting y (yank) then escape there is no contents in the clipboard.

enter image description here https://www.python.org/about/gettingstarted/

What else needs to be done?

  • Are you really pressing Esc before y? Because that wil cancel the visual mode selection.
    – Rich
    Feb 20 '18 at 22:27
  • Nice observation: I corrected the post and included screenshot of yanked message. Feb 20 '18 at 22:46

Using clipboard=unnamed requires that your copy of Vim has system clipboard support built in. You can check this with the command:

echo has('clipboard')

Or simply by inspecting the output of:

  • trying this out .. hold on Feb 20 '18 at 23:14
  • has(clipboard) returns 0 ;( So looks like I should reinstall vim. Thx for the heads up. Feb 20 '18 at 23:15
  • Update: I installed gnome-vim which returns 1 for has('clipboard') and saw 'yanked 7 lines` but still nothing in clipboard. Feb 20 '18 at 23:25
  • @javadba How are you checking? clipboard=unnamed will mean yanked text goes into the "PRIMARY selection". Possibly you want clipboard=unnamedplus instead?
    – Rich
    Feb 20 '18 at 23:45
  • tried the clipboard=unnamedplus: also does not work. I am running this in docker: and it appears the problem were a general one with the clipboard sharing with a macos host: stackoverflow.com/questions/41703070/… Feb 20 '18 at 23:51

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.