I am trying to use Vim to locate and copy/paste some code I need to analyze and take notes on. I am using Debian, in a Windows WSL environment. That's what makes this tricky.
The regular "yank and put to global register" commands "+y
and "*y
commands didn't work.
On the other hand, the brute force approach where I just use the mouse to scrape the terminal text won't work either. Strangely, WSL terminal has mouse support, and Vim can track its movements, select in visual mode, etc. So Vim intercepts the selection command, and then there is nothing selected for ctrl-shift-c to copy into the Windows clipboard.
I know the WSL terminal supports copy and paste, and I can successfully do it if I cat
my file to the screen, and copy and paste that using ctrl-shift-c and ctrl-v. But then I lose out on ease of navigation.
What's the best way to copy text out of Vim inside a WSL terminal and into the windows clipboard?
:set mouse=
– Christian Gibbonsclip.exe
to access the clipboard from WSL? If so, select the lines visually them run:w !clip.exe
. (Source for theclip.exe
suggestion: raymondcamden.com/2017/10/19/…) – filbranden