Enable vi mouse wheel scroll using bash on ubuntu on windows 10

I use bash on ubuntu in windows 10 and would like to enable mouse wheel scroll in vi or vim. I tried to enter the following command in vim and added it to the .vimrc file and / usr / share / vim / vim 74 / debian.vim

set mouse=a 

However, I still cannot scroll with the mouse.

+8
source share
4 answers

Quick and easy answer:

If you use mintty / wsltty , it works great!

+4
source

You have completed, correctly, all you can in vim , and the problem is with your terminal emulator.

The mouse wheel that scrolls the scroll buffer of the terminal emulator is a function of the terminal emulator that consumes mouse events. You want to send these events to an application ( vim ) connected to the terminal.

Most terminal emulators have the ability to enable the forwarding of mouse events when they are in “application key mode” or “Alternate screen”. Most of them also support the use of a modifier key (for example, holding ALT), which will go through the mouse events as you wish.

+3
source

Your version of Vim may not have been compiled with mouse support. See if you can get gvim . It contains a graphical version of Vim. Depending on your distribution, it may also contain a vim terminal, with almost all functions included, including mouse support.

To check mouse support in Vim, type :version and check if +mouse in the list of functions.

0
source

I added this to my /etc/vim/vimrc.local and it worked:

 set mouse=a map <ScrollWheelUp> <CY> map <ScrollWheelDown> <CE> 
0
source

Source: https://habr.com/ru/post/1259689/


All Articles