0

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>
llinfeng
  • 1,173
  • 2
  • 15
  • 36
  • Please [do not edit your original question to include an answer](https://meta.stackexchange.com/a/216722/271445). – I say Reinstate Monica Oct 23 '18 at 15:52
  • 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. – I say Reinstate Monica Oct 24 '18 at 16:36
  • The challenge is, the [marked duplicate](https://superuser.com/questions/1291425/windows-subsystem-linux-make-vim-use-the-clipboard) 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
  • you need to edit your question and clearly explain why it's not a duplicate. Then it can be reopened. – I say Reinstate Monica Oct 25 '18 at 02:43
  • 1
    Have you actually tried the solution (https://superuser.com/a/1345241/117820; i.e. installing VcXsrv)? The registers `*` and `+` both require a connection to the X server. – Ingo Karkat Oct 25 '18 at 06:18
  • That notwithstanding, I've also reopened this question. Please edit and new facts and findings into the question; I'm sceptical that it will attract answers in the current form. – Ingo Karkat Oct 25 '18 at 06:22
  • Thank you for lifting the embargo, and getting me a chance to make the QA readable. – llinfeng Oct 25 '18 at 17:03

1 Answers1

2

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.

llinfeng
  • 1,173
  • 2
  • 15
  • 36