How to disable mouse scroll wheel when in insert mode?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

How to disable mouse scroll wheel when in insert mode?

Glenn Todd Miller

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?

 

Outside of insert mode the mouse scroll is a great feature, so I only

want to disable it when in insert mode.

Thanks for any help,

 

 

 

--
--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

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

Marcin Szamotulski
On 18:46 Fri 24 Jan     , 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?
>
> Outside of insert mode the mouse scroll is a great feature, so I only
> want to disable it when in insert mode.
> Thanks for any help,
>
>
>
> --
> --
> 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 [hidden email].
> For more options, visit https://groups.google.com/groups/opt_out.


I don't think that you can disable the mouse wheel.  But you can use
^r in insert mode to paste from various registers, e.g. from clipboard.
Read more in :help i^r

Best regards,
Marcin Szamotulski

--
--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

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

Israel-25
In reply to this post by Glenn Todd Miller
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

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

Marcin Szamotulski
On 13:46 Sat 25 Jan     , Israel Chauca wrote:

> 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

Wow!  I'll helpgrep next time.

Thanks,
Marcin

--
--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

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

John Little-4
In reply to this post by Israel-25
On Sunday, January 26, 2014 7:46:17 AM UTC+13, Israel Chauca F. wrote:

> The following mappings seem to do the trick...

I know the OP is on CentOS, but FWIW the mappings don't work on Windows; the mouse wheel handling is hard-coded there.

Regards, John Little

--
--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

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

Marcin Szamotulski
On 19:16 Sat 25 Jan     , John Little wrote:
> On Sunday, January 26, 2014 7:46:17 AM UTC+13, Israel Chauca F. wrote:
>
> > The following mappings seem to do the trick...
>
> I know the OP is on CentOS, but FWIW the mappings don't work on Windows; the mouse wheel handling is hard-coded there.
>
> Regards, John Little

They work on Linux.

Regards,
Marcin

--
--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

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

Terrance Chen
In reply to this post by Glenn Todd Miller
在 2014年1月25日星期六UTC+8上午2时46分44秒,Glenn Todd Miller写道:

> 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?
>
>  
>
> Outside of insert mode the mouse scroll is a great feature, so I only
>
> want to disable it when in insert mode.
>
> Thanks for any help,
>
>  
>
>  
>
>  
my advise is do not use mouse at all

--
--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

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

Glenn Todd Miller
In reply to this post by Marcin Szamotulski
Thanks for the replies but I am not having luck with the mappings.
When I am in INSERT mode the mouse wheel still works.  
FYI I am in a gnome-terminal when I use vi, although I would not
think this should matter.

Interestingly I was able to 'disable' the mouse wheel for 'normal' mode only using

          :nmap  <MouseScrollWheelUp>  <nop>    

which looks like this on my screen  :nmap  ^[OA  <nop>
and of course the MouseScrollWheelDown  (which is ^[OB ) too.

Once I executed those 2 nmap commands in my vi session, I could no longer
move the cursor with the mouse's scroll wheel.  It would be fantastic if
I could get this same behavior when I am in insert mode.

So next I tried the same technique with all the other 'map' commands,
using 'imap' for insert, 'map!', 'vmap', .... etc.   And again, the ONLY
mode in which the scroll wheel was disabled was the 'normal' mode.

Thanks for any suggestions,
-Glenn


-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Marcin Szamotulski
Sent: Sunday, January 26, 2014 5:43 AM
To: [hidden email]
Subject: Re: How to disable mouse scroll wheel when in insert mode?

On 19:16 Sat 25 Jan     , John Little wrote:
> On Sunday, January 26, 2014 7:46:17 AM UTC+13, Israel Chauca F. wrote:
>
> > The following mappings seem to do the trick...
>
> I know the OP is on CentOS, but FWIW the mappings don't work on Windows; the mouse wheel handling is hard-coded there.
>
> Regards, John Little

They work on Linux.

Regards,
Marcin

--
--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.

--
--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

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

John Little-4
On Tuesday, January 28, 2014 11:25:27 AM UTC+13, Glenn Todd Miller wrote:

> Thanks Vfor the replies but I am not having luck with the mappings.
>
> When I am in INSERT mode the mouse wheel still works.  
>
> FYI I am in a gnome-terminal when I use vi, although I would not
> think this should matter.
>
> Interestingly I was able to 'disable' the mouse wheel for 'normal' mode only using
>
>           :nmap  <MouseScrollWheelUp>  <nop>    

That's not right, it's "<ScrollWheelUp>", the word "Mouse" is not used, but if it worked, I presume that's a mistake in your post.

> which looks like this on my screen  :nmap  ^[OA  <nop>
> and of course the MouseScrollWheelDown  (which is ^[OB ) too.

I don't understand that, or what you are doing.  It should look exactly like

:inoremap <ScrollWheelDown> <nop>
:inoremap <ScrollWheelUp>   <nop>

on your screen, no control sequences.  Just fired up gnome-terminal (for the first time in several years, it doesn't play well with KDE) and those exact commands worked.

Also, if I use control-V to find what gnome-terminal sends for the scroll wheel I get something like
    ^[[<65;7;26M
and
    ^[[<64;15;28M

(they vary depending on something, maybe the screen position, so you couldn't map them that way).

^[OA and ^[OB are the sequences for up arrow and down arrow.  If you are getting those when you use the scroll wheel, then that's your problem, something is changing the scroll actions to arrow key presses.  To check that out, in vim in insert mode press ctrl-v then move the scroll wheel one notch.

(Interestingly, I checked out xterm and konsole; xterm is the same or similar to gnome-terminal, but konsole sends ^[[M`P6 and ^[[MaP6.  What the second and third numbers are in the xterm and gnome-terminal sequences, and how vim sorts it all out, has me perplexed.)

Regards, John Little

--
--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

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

Gary Johnson-4
On 2014-01-27, John Little wrote:

> Just fired up gnome-terminal (for the first time in several years,
> it doesn't play well with KDE) and those exact commands worked.

When you start gnome-terminal in KDE, does it get narrower in small
steps until it is about 20 columns wide?

Regards,
Gary

--
--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

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

John Little-4
On Tuesday, January 28, 2014 2:03:52 PM UTC+13, Gary Johnson wrote:

> When you start gnome-terminal in KDE, does it get narrower in small
> steps until it is about 20 columns wide?

Yes.  I gathered that the gnome 3 people say kwin acts on a misinterpretation of some standard, and their way is the only right way to do things.  Very Gnome 3-ish.  Also, I'm a fan of a 4 or 5 Hz cursor blink, and to persuade gnome-terminal to blink quickly the gnome settings daemon has to be running, and I used to do that, but I couldn't get the Gnome 3 one to run without the rest of Gnome, which I don't want.  I found how to quicken the cursor in konsole (it's a qt4 setting) and quite like it now.

Regards, John Little

--
--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

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

John Little-4
In reply to this post by John Little-4
Glenn Todd Miller replied to my post by e-mail, because he wanted to include screenshots.  

They demonstrate that he is using

:inoremap <ScrollWheelDown> <nop>

but as I suggested be checked out, Glenn is getting ^[OA and ^[OB arrow key sequences when the mouse wheel is used.

What could be causing this?  I have no idea, other than I'm told it's possible using easystroke, an X mouse gesture tool.  His CentOS is

Red Hat Enterprise Linux Workstation release 6.5 (Santiago)

Regards, John Little

--
--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

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

Qianfeng Shen
On Wednesday, January 29, 2014 at 5:23:04 AM UTC-5, John Little wrote:

> Glenn Todd Miller replied to my post by e-mail, because he wanted to include screenshots.  
>
> They demonstrate that he is using
>
> :inoremap <ScrollWheelDown> <nop>
>
> but as I suggested be checked out, Glenn is getting ^[OA and ^[OB arrow key sequences when the mouse wheel is used.
>
> What could be causing this?  I have no idea, other than I'm told it's possible using easystroke, an X mouse gesture tool.  His CentOS is
>
> Red Hat Enterprise Linux Workstation release 6.5 (Santiago)
>
> Regards, John Little
Hi Jone,

Have you found any solution of this issue, I'm still suffering from this on Ubuntu 16.04: my mouse scroll up/down are binded to keyboard arrow up/down. My terminal is konsole.

It would be greatly appreciated if you have some clue of why this happened.

Best,
Clark

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

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

Qianfeng Shen
In reply to this post by John Little-4
On Wednesday, January 29, 2014 at 5:23:04 AM UTC-5, John Little wrote:

> Glenn Todd Miller replied to my post by e-mail, because he wanted to include screenshots.  
>
> They demonstrate that he is using
>
> :inoremap <ScrollWheelDown> <nop>
>
> but as I suggested be checked out, Glenn is getting ^[OA and ^[OB arrow key sequences when the mouse wheel is used.
>
> What could be causing this?  I have no idea, other than I'm told it's possible using easystroke, an X mouse gesture tool.  His CentOS is
>
> Red Hat Enterprise Linux Workstation release 6.5 (Santiago)
>
> Regards, John Little
Hi John,

Have you found any solution of this issue, I'm still suffering from this on Ubuntu 16.04: my mouse scroll up/down are binded to keyboard arrow up/down. My terminal is konsole.

It would be greatly appreciated if you have some clue of why this happened.

Best,
Clark

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.