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.
After studying above article, here i provided some steps to enable mouse wheel scrolling in Ubuntu under VMware. 1) Open terminal 2) issue command “sudo gedit /etc/X11/xorg.conf”
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.
Try changing the "Screen Buffer Height" of the ubuntu command prompt to something like 9001. That should make the scroll bar re-appear. Sorry, something went wrong. The scroll bar is there and I can scroll with it ok. The thing that is broken is scrolling using the mouse wheel, but it is only broken if the windows is active.
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.
I added this to my /etc/vim/vimrc.local
, and it worked:
set mouse=a
map <ScrollWheelUp> <C-Y>
map <ScrollWheelDown> <C-E>
Quick and simple answer:
If you use mintty/wsltty it works just fine!
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With