jiangmiao/auto-pairs

Fast wrap not working in Windows Subsystem for Linux 2 (wsl2)

Closed this issue · 8 comments

Environment:
Windows 10 [Version 10.0.19043.1110]
WSL2 kernel version 5.10.16.3
Ubuntu 20.04
VIM version 8.1.2269
https://github.com/junegunn/vim-plug

I had to add below lines in .vimrc to map alt key combination to M- modifier, as described in this stackoverflow answer

if has('unix')
    map <Esc>e <M-e>
    map <Esc>p <M-p>
    map <Esc>n <M-n>
    map <Esc>b <M-b>
    map <Esc>j <M-j>
    map <Esc>k <M-k>
endif

Fast wrapping doesn't work in above environment, as shown in screenshot below.
inubuntu

Pressing alt key combination works in Ubuntu in wsl in Windows 10, as pressing Alt-p works to disable/enable auto-pairs, and shown in below screenshot for pressing Alt-e:
화면 캡처 2021-08-07 004822

Plugin works in other environments, such as in gVim:
ingvim

and in Powershell using vim for windows that comes with gVim:
inpwsh

Pressing alt key combination works in Ubuntu in wsl in Windows 10, as pressing Alt-p works to disable/enable auto-pairs, and shown in below screenshot for pressing Alt-e:

Sooo what's the problem if everything works?

Don't forget verbose imap <M-e>

Pressing alt key combination works in Ubuntu in wsl in Windows 10, as pressing Alt-p works to disable/enable auto-pairs, and shown in below screenshot for pressing Alt-e:

Sooo what's the problem if everything works?

Don't forget verbose imap <M-e>

I can see I'm pressing Alt-e in console using sed -n l, but plugin won't run fast wrap 😢
verbose imap <M-e> shows me:

i  <M-e>       *@<C-R>=AutoPairsFastWrap()<CR>
        Last set from ~/.vim/plugged/auto-pairs/plugin/auto-pairs.vim line 562

Updated Vim version in Ubuntu to 8.2.2815 to no avail.
Installed neovim version 0.6.0 and it works with neovim in Ubuntu.
inneovim

Sounds like a Vim bug then. Open an issue there instead

Probably a bug in Vim. See vim/vim#8726

please describe exactly what the vim bug should be

If it works in Neovim, but not in Vim, in the same terminal, in the same Linux subsystem, it's reasonable to assume it's something preventing Vim from properly handling the input. Especially when considering it's status-norepro seemingly everywhere but Vim (and not Neovim) in WSL. I'm on a Linux machine though, so I can't verify.

The problem is solved by using different remapping method which you can read in vim/vim#8726, which I think is a work-around, as I could pass Alt key combinations to execute other commands successfully even with my original remappings. Nonetheless, the problem at hand is solved.