Search code examples
vimarchlinuxgnome-terminal

How to disable vim mouse wheel?


I want to know how to disable mouse wheel, however I found this and this question and I have tried put them to my .vimrc:

set mouse=""

map <ScrollWheelUp> <nop>
map <S-ScrollWheelUp> <nop>
map <ScrollWheelDown> <nop>
map <S-ScrollWheelDown> <nop>

But none of them will disable the mouse wheel, I still can use it to scrolling.

And I'm on Arch Linux, using vim 7.4 with gnome-terminal 3.16.2.


Solution

  • It is probably a gnome-terminal problem and not a Vim one. With your .vimrc as it is, you can turn on and off the mouse wheel by issuing these commands in terminal

    echo -e '\e[?1000h'
    echo -e '\e[?1000l'
    

    Edit: Previous answer doesn't work because gnome-terminal settings are overridden by settings of Cinnamon (in this case), and maybe also because the scrolling was done using a touchpad and not a mouse. It is possible to disable scrolling with help of Synclient (command line utility to configure and query Synaptics driver settings) putting

    augroup scroll
        au!
        au  VimEnter * :silent !synclient VertEdgeScroll=0
        au  VimLeave * :silent !synclient VertEdgeScroll=1
    augroup END
    

    in your .vimrc.

    This solution is not optimal for disabling scrolling even outside of Vim for as long as Vim runs.