Monday, January 27, 2014

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

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 vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment