Disabling two-finger scrolling in Vim

While using Vim(v7.3.353-2 at the time of writing), it's frustrating and time-consuming if my palm accidentally touches the trackpad while resting my hands on the keyboard and causes a scroll in Vim that alters my cursor's position.

How to disable this behaviour?


Solution 1:

You can remap those bindings to a no-operation (see :help <scrollwheel:

noremap <ScrollWheelUp>      <nop>
noremap <S-ScrollWheelUp>    <nop>
noremap <C-ScrollWheelUp>    <nop>
noremap <ScrollWheelDown>    <nop>
noremap <S-ScrollWheelDown>  <nop>
noremap <C-ScrollWheelDown>  <nop>
noremap <ScrollWheelLeft>    <nop>
noremap <S-ScrollWheelLeft>  <nop>
noremap <C-ScrollWheelLeft>  <nop>
noremap <ScrollWheelRight>   <nop>
noremap <S-ScrollWheelRight> <nop>
noremap <C-ScrollWheelRight> <nop>

Solution 2:

I think this is a problem with your terminal program. I just tried yakuake and it looks like its some variant on KDE's konsole. There is an open bug on this:

https://bugs.kde.org/show_bug.cgi?id=170582

Perhaps naively, I hope that fixing this bug for konsole will also fix the behaviour for yakuake.