Answer is, do a vim visual selection then do the command:
:'<,'>w !clip.exe
This pipes the current selection out to the shell command clip.exe
, which utilizes WSL's ability to execute Windows executables (even with a pipeline). Text piped to clip.exe
goes to the Windows clipboard.
Also, this command saves the whole file to the clipboard (not the requirement):
:w !clip.exe