Vim Wsl Clipboard
I’ve long used neovim from within windows wsl, and for far too long, I went
without a proper way to get text out of it and into windows.
wsl has access to cmd applications # [1]
wsl can access clip.exe. You can do some cool things with it, such as
cat a file into the clipboard, sending output from a command to the clipboard,
or set an autocmd group in vim to send yank to the windows clipboard.
using clip.exe # [2]
Let’s say you want to send a teammate the tail of a log file over chat. You can
tail the file into clip.exe.
tail -n 1 info.log | clip.exe
pipe streams of text into clip.exe
make it a bit more natural # [3]
I recently made mine feel a bit more natural by aliasing it to clip.
alias clip=clip.exe
pop this in your ~/.bashrc or ~/.zshrc
yanking to windows clipboard from vim # [4]
I use neovim as my daily text editor and its a pain to share code with a
teammate over chat, stack overflow, into a gist, or whatever you need. The
following snippet has been quite useful ...