I have just installed MacVim on my new Macbook.

But I have a problem: on Linux I was able to scroll through my code—vertically moving my cursor—by using my trackpad. But on Macvim this doesn't work for me.

When scrolling in Macvim, the buffer/window scrolls but the cursor doesn't move.

I made a little video demonstrating the issue: here you see the buffer moving when I scroll using my trackpad, but not my cursor scrolling.

I tried to fix this error by using the command :set mouse=a, but without success. I also took a look at MouseTerm (using SIBML), but this doesn't seem trustworthy and a little bit overkill to just enable good scrolling behavior.

I found a solution which came close:

nnoremap <ScrollWheelUp> k
nnoremap <ScrollWheelDown> j

However, this scrolling is not even close to smooth and I was hoping for a more elegant way to solve this than remapping.

By the way, scrolling does work fine in the normal Vim using the Terminal as long as Mouse Reporting is enabled.

TL;DR: How to enable smooth scrolling behavior with trackpad in Macvim? Thanks!

1 Answer 1


Here's what I could find in the help

When your mouse has a scroll wheel, it should work with Vim in the GUI.  How
it works depends on your system.  It might also work in an xterm
|xterm-mouse-wheel|.  By default only vertical scroll wheels are supported,
but some GUIs also support horizontal scroll wheels.


For the X11 GUIs (Motif, Athena and GTK) scrolling the wheel generates key
presses <ScrollWheelUp>, <ScrollWheelDown>, <ScrollWheelLeft> and
<ScrollWheelRight>.  For example, if you push the scroll wheel upwards a
<ScrollWheelUp> key press is generated causing the window to scroll upwards
(while the text is actually moving downwards).  The default action for these
keys are:
    <ScrollWheelUp>     scroll three lines up   *<ScrollWheelUp>*
    <S-ScrollWheelUp>       scroll one page up      *<S-ScrollWheelUp>*
    <C-ScrollWheelUp>       scroll one page up      *<C-ScrollWheelUp>*
    <ScrollWheelDown>       scroll three lines down *<ScrollWheelDown>*
    <S-ScrollWheelDown>     scroll one page down    *<S-ScrollWheelDown>*
    <C-ScrollWheelDown>     scroll one page down    *<C-ScrollWheelDown>*
    <ScrollWheelLeft>       scroll six columns left *<ScrollWheelLeft>*
    <S-ScrollWheelLeft>     scroll one page left    *<S-ScrollWheelLeft>*
    <C-ScrollWheelLeft>     scroll one page left    *<C-ScrollWheelLeft>*
    <ScrollWheelRight>      scroll six columns right    *<ScrollWheelRight>*
    <S-ScrollWheelRight>    scroll one page right   *<S-ScrollWheelRight>*
    <C-ScrollWheelRight>    scroll one page right   *<C-ScrollWheelRight>*
This should work in all modes, except when editing the command line.

and finally

Note that horizontal scrolling only works if 'nowrap' is set.  Also, unless
the "h" flag in 'guioptions' is set, the cursor moves to the longest visible
line if the cursor line is about to be scrolled off the screen (similarly to
how the horizontal scrollbar works).

So it may have something to do with How it works depends on your system—the listed systems are mostly X11. I don't have a MacVim to check more relevant docs on though:

:help mac
NOTE: This file is a bit outdated.  You might find more useful info here:

Some more things I’ve learned—MacVim tries to scroll the window, rather than scrolling the cursor. This seems to be acceptable and even considered default behavior (though I agree it’s different from the terminal). Still looking for a solution, but I suspect it will require changing the way the mouse works with the gui.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.