Skip to main content
Added some detail on why this works
Source Link
NotTheDr01ds
  • 18.9k
  • 7
  • 56
  • 82

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

Answer is, do a vim visual selection then do the command

:'<,'>w !clip.exe

This saves the whole file to the clipboard (not the requirement):

 :w !clip.exe

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
Source Link
fencemaker
  • 541
  • 4
  • 4

Answer is, do a vim visual selection then do the command

:'<,'>w !clip.exe

This saves the whole file to the clipboard (not the requirement):

 :w !clip.exe