Saturday, January 25, 2014

Re: How to disable mouse scroll wheel when in insert mode?

On 1/24/14, 1:46 PM, Glenn Todd Miller wrote:
> Long time vim user looking for some advice on this, tried searching the
> web to no avail. I am using CentOS 6 and vim 7.2.411.
>
> My issue: In vim, I am in INSERT mode, my cursor is where I want it to be
> for a PASTE operation, but when I press the middle mouse button (which in
> my case is a scroll wheel) to do the paste the wheel moves inadvertently
> and I end up pasting somewhere else, not in the place where my cursor
> was when I entered INSERT mode.
>
> Is there a way to configure vim so that the mouse scroll wheel/middle
> mouse button is disabled when in INSERT mode?

The following mappings seem to do the trick:

inoremap <ScrollWheelUp> <Nop>
inoremap <ScrollWheelDown> <Nop>

I found them by typing:

:help Scroll<C-D>

and looking on the listed items. <C-D> is Ctrl-D.

Cheers!
Israel

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: