For the bare version of Vim that comes with WSL on Windows 10, attempts to "yank to registry *" will fail with the following error message:

enter image description here

One way to reproduce the symptom is to assign the following mapping, and invoke it by pressing Y in normal mode.

nnoremap Y :let @* = expand("%:p")<CR>
  • This question has been marked duplicate; and there is no way to submit an answer. – llinfeng Oct 24 '18 at 16:20
  • Kept what I've learned in the body of the question, for documentation. Thank for pointing out @TwistyImpersonator – llinfeng Oct 24 '18 at 16:21
  • If you wish to submit an answer, then either your question is not a duplicate (in which case you should edit it to indicate why not), or you can submit the answer to the marked duplicate question. Thanks for contributing. – Twisty Impersonator Oct 24 '18 at 16:36
  • The challenge is, the marked duplicate is not truly a duplicate: it is about how to let Vim write to the Windows OS's clipboard. My original question is about letting Vim to write to its own * registry. @Ingo Karkat, please lift the embargo. – llinfeng Oct 24 '18 at 21:32

Short solution

In reference to the discussion here, installing a "full" version of Vim through apt-get install vim-gtk solves the trouble.

Longer explanation

WSL on Windows 10 is shipped with the basic version of Vim, which does not have clipboard support.

  • To verify this, executing :echo has('clipboard') will yield 0.

Installing the vim-gtk equips Vim with the clipboard functionality.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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