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.
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.
Dell XPS and Ubuntu 16.04 makes using the scrollwheel with vim an unbearable experience where I can't type anything because my hand makes the cursor move every few characters!!
Add this to .vimrc
to completely disable mouse scrolling:
set mouse=a
nmap <ScrollWheelUp> <nop>
nmap <S-ScrollWheelUp> <nop>
nmap <C-ScrollWheelUp> <nop>
nmap <ScrollWheelDown> <nop>
nmap <S-ScrollWheelDown> <nop>
nmap <C-ScrollWheelDown> <nop>
nmap <ScrollWheelLeft> <nop>
nmap <S-ScrollWheelLeft> <nop>
nmap <C-ScrollWheelLeft> <nop>
nmap <ScrollWheelRight> <nop>
nmap <S-ScrollWheelRight> <nop>
nmap <C-ScrollWheelRight> <nop>
imap <ScrollWheelUp> <nop>
imap <S-ScrollWheelUp> <nop>
imap <C-ScrollWheelUp> <nop>
imap <ScrollWheelDown> <nop>
imap <S-ScrollWheelDown> <nop>
imap <C-ScrollWheelDown> <nop>
imap <ScrollWheelLeft> <nop>
imap <S-ScrollWheelLeft> <nop>
imap <C-ScrollWheelLeft> <nop>
imap <ScrollWheelRight> <nop>
imap <S-ScrollWheelRight> <nop>
imap <C-ScrollWheelRight> <nop>
vmap <ScrollWheelUp> <nop>
vmap <S-ScrollWheelUp> <nop>
vmap <C-ScrollWheelUp> <nop>
vmap <ScrollWheelDown> <nop>
vmap <S-ScrollWheelDown> <nop>
vmap <C-ScrollWheelDown> <nop>
vmap <ScrollWheelLeft> <nop>
vmap <S-ScrollWheelLeft> <nop>
vmap <C-ScrollWheelLeft> <nop>
vmap <ScrollWheelRight> <nop>
vmap <S-ScrollWheelRight> <nop>
vmap <C-ScrollWheelRight> <nop>
You will no longer be able to copy selections using Ctrl+Shift+C using the Terminal's bindings, so you'll have to use "+y
within vim to copy your selection into the system clipboard.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With