Search code examples
vimscrolliterm2cursor-position

iTerm2 cursor scrolling with mouse enabled in vim


iTerm2 has a very nice feature that allows, when scrolling the mouse, to move the cursor up and down.

enter image description here

However, if I enable the mouse in vim with :set mouse=a, the scrolling behavior changes: it now scrolls the file but does not move the cursor until the cursor gets out of view.

Is there a way to keep the iTerm2 scrolling along with mouse enabled in vim?


Solution

  • Does this help?

    map <ScrollWheelDown> j
    map <ScrollWheelUp> k
    

    Have a look at :help scroll-mouse-wheel.