Enable vi mouse wheel scrolling using bash on ubuntu on windows 10
Solution 1
Quick and simple answer:
If you use mintty/wsltty it works just fine!
Solution 2
I added this to my /etc/vim/vimrc.local
, and it worked:
set mouse=a
map <ScrollWheelUp> <C-Y>
map <ScrollWheelDown> <C-E>
Solution 3
You have done, properly, all you can in vim
and the problem is with your terminal emulator.
Mouse wheel scrolling through the scrollback buffer of a terminal emulator is a function of the terminal emulator which is consuming the mouse events. You are wanting to send these events to the application (vim
) hooked to the terminal.
Most terminal emulators have a way to enable the passthrough of mouse events when in "Application Key Mode" or "Alternate Screen". Most also support using a modifier key (like holding ALT) that will passthrough the mouse events as you wish.
nak3c
Updated on July 06, 2022Comments
-
nak3c almost 2 years
I'm using bash on ubuntu on windows 10 and would like to enable scrolling using the mouse wheel in vi or vim. I've tried entering the following command in vim and added it to the .vimrc file and /usr/share/vim/vim74/debian.vim
set mouse=a
However I still can't scroll with the mouse.
-
Salman von Abbas over 7 yearsIt's whatever compiled version that comes included with "Bash on Ubuntu on Windows", which does seem to have
+mouse
: dl.dropboxusercontent.com/u/11137205/x/tQhEBfNU.png . gVim will need to have an X server installed, which is probably a whole new can of worms, seeing how broken everything is currently. -
Salman von Abbas over 7 yearsHolding any of
Ctrl/Alt/Shift
while scrolling doesn't seem to help. -
Márcio Moreira almost 5 yearsThis is a much simpler solution than install WSLtty. Thanks.
-
ffuentes over 4 yearsmy installation didn't include that file but it does work once added.
-
hmcclungiii over 4 years
set mouse=a
in/etc/vim/vimrc.local
is a much better solution. -
razz about 2 yearsBrilliant. Just a note though, you can use
/home/<your username>/.vimrc
file as well to add these configurations.