Use mouse scroll wheel in Vim

Kit picture Kit · Aug 29, 2011 · Viewed 55.1k times · Source

My .vimrc has the following lines

set mouse=a
map <ScrollWheelUp> <C-Y>
map <ScrollWheelDown> <C-E>

But when I scroll up using the mouse wheel, I'd get the text above Vim. For example, I'd get my terminal session text if I'd just started Vim. I'm initially experimenting with the mouse scroll wheel on help files, then move on to other files, hence the a option.

What else do I need to set? I'm using Snow Leopard and Vim 7.3 inside a Terminal.

Here, I just did a wheel up. See the Terminal session at the top. enter image description here

Answer

taylor picture taylor · Oct 27, 2015

Using vim in iTerm 2 in OS X, you can :set mouse=a to enable scrolling with the scroll wheel, as well as selecting to enter Visual mode, etc.