This is a page that will be kept updated as I find solutions to the quirks of using Vim in WSL2
The first thing we miss, when using Vim in WSL2 is native copy and paste.
"+y and "+p
Download and install the following package from Github https://github.com/equalsraf/win32yank/releases
Then add the following to your Vim configuration, which I found at https://superuser.com/a/1557751
set clipboard+=unnamedplus
let g:clipboard = {
\ 'name': 'win32yank-wsl',
\ 'copy': {
\ '+': 'win32yank.exe -i --crlf',
\ '*': 'win32yank.exe -i --crlf',
\ },
\ 'paste': {
\ '+': 'win32yank.exe -o --lf',
\ '*': 'win32yank.exe -o --lf',
\ },
\ 'cache_enabled': 0,
\ }
For this to work best we use Windows Terminal
When using Windows Terminal, we can’t use Visual Block mode.
To fix this, just remove Ctrl + V and Ctrl + C in settings.json so you have visual block mode
tags: wsl2 - vim