On one of the systems vim has a very annoying "feature" that mouse wheel moves the cursor between lines causing typos.
I added these lines into ~/.vimrc but the cursor is still scrolling:
inoremap <ScrollWheelUp> <Nop>
inoremap <ScrollWheelDown> <Nop>
vim versions 7.4.1099 and 8.1.1989.
Also what exactly triggers this "feature" and why does it exist on some systems and not on others?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
You do not have the mouse feature enabled (e.g. set mouse=a, or simply because the terminal doesn't support it). When the application inside a terminal doesn't use the mouse, you'll get cursor up / down events for scolling.
So how to turn this off? Why the above commands don't disable such events?
so disable your mouse setting. :set mouse=
so disable your mouse setting. :set mouse=
This doesn't solve the problem.
then please compare your settings. Note, this is a bug tracker here but we cannot provide individual help here. Use the existing support channels (vi.stackexchange.com or vim_use mailinglist).
Which do you use, console or GUI?
See also :help scroll-mouse-wheel.
I use both 2 GUI-based terminals. Local and remote, Gnome and Xfce4, and both have this problem.
I view this as a bug because
inoremap <ScrollWheelUp> <Nop>
inoremap <ScrollWheelDown> <Nop>
instructions don't disable mouse wheel. If they don't do that, what do they do then?
if it works in one vim instance and doesn't in another that very much hints to your configuration. So please check your configuration.
<ScrollWheelUp> is a key for X11 GUI as written in the above help.
For console version, see also :help xterm-mouse-wheel. It's a matter of your terminal.
I am on FreeBSD. When I connect from the xfce4 terminal on FreeBSD to CentOS and use vim - there is a problem. When I connect to another FreeBSD box or another Linux box - there is no problem. vim version is the latest in all cases, configuration on the client is identical, on the server ~/.vimrc is blank. What configuration should I be looking at?
I am connecting from the GUI terminal, so
<ScrollWheelUp>should be relevant?
No, it is not for vim inside a GUI terminal, it is for gVim,
Not enough information. I suppose you are using ssh? does it happen without X11-forwarding? do you use gvim or vim on the remote system? What version of vim is on the remote system running? Check your environment on the remote side for differences? Perhaps it is using a different $TERM? Check the output of :set or :set all, check the output of :scriptnames. Compare the output of :version from both remote sides.
Note, this is all very basic configuration stuff here. You need to find the relevant difference between the system. If you don't know how to configure Vim or how to check the settings, please first seek help in the proper support channels. As said before, we cannot support here individual help and in the other channels, there are more people helping out so it is easier to find the problem.
I suppose you are using ssh?
Yes.
does it happen without X11-forwarding?
Yes.
do you use gvim or vim on the remote system?
vim
What version of vim is on the remote system running?
Both 7.4.1099 and 8.1.1989 have the same problem.
Perhaps it is using a different $TERM?
Nope. The terminals are the same TERM=xterm-256color
Check the output of :set or :set all
The problematic CentOS system has
:set
--- Options ---
helplang=en scroll=19 ttyfast ttymouse=sgr
fileencodings=ucs-bom,utf-8,default,latin1
The FreeBSD system has no such problem and has
:set
--- Options ---
autoindent belloff=all expandtab incsearch showmatch ttymouse=sgr
autoread directory=/tmp// history=100 ruler smarttab undodir=/tmp//
backupdir=/tmp// display=truncate hlsearch scroll=19 ttyfast wildmenu
backspace=indent,eol,start
fileencodings=ucs-bom,utf-8,default,latin1
formatoptions=tcqj
listchars=tab:»·,trail:·,precedes:<,extends:>
No, it is not for vim inside a GUI terminal, it is for gVim,
Could you please tell me how to disable mouse cursor scrolling in a GUI terminal?
It should be possible to disable such feature.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.![]()
What does :set mouse? say in both cases? What is your mouse cursor shape, a pointer or an I shape?
When vim receives mouse scroll events it translates them into terminal sequences moving the cursor.
No. When Vim receives mouse scroll events, it recognizes such events and scrolls the window under the cursor (the mouse cursor is a pointer in xfce4-terminal). When Vim doesn't use the mouse, the terminal receives mouse scroll events and translates them into terminal sequences moving the cursor, and Vim receives such events (the mouse cursor is an I shape).
In insert mode, press Ctrl-V and then scroll your mouse wheel, you'll see what codes Vim has received.
I try to paste, press the middle button, and the wheel scrolls a bit and the text goes into a wrong line.
You may want a mouse that is more stable and doesn't do what you didn't want to do.
I am having the same issue on libvte-based terminals. It seems like libvte automatically converts scroll events to cursor movements in some cases (src), so this might be a libvte issue rather than a vim issue.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.![]()
I'm having the same problem.
The only solution I have found is to use a terminal emulator like rxvt. Otherwise, every other terminal emulator (gnome-terminal, konsole, kitty, etc) do the same thing.
This is a really annoying feature. It should be possible to disable mouse scrolling in vim. Especially in insert mode.
I have been using vi for almost 30 years. These strange "features" seem to creep up recently. Have been doing a lot of searching to turn off these bugs ("features").
Some great settings to disable some of these bugs (features):
set t_BE=
set mouse=
set ttymouse=
But none of these fix the scroll wheel problem.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
I guess you want to make sure to disable the mouse scroling in Vim + optionally also disable mouse scrolling in your terminal then. It seems you found a solution for the first problem, but are looking for a solution to the second problem (in which case the vim repository is not the best place to ask for help)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you commented.![]()
Yes, that does turn off the scroll wheel, but then every mouse click enters visual mode and vim gets really annoying.
For example, start editing a line (press i for insert mode), double click on a text somewhere else in vim and middle click to paste it. During that process you go into visual mode and the paste does not go where I was editing, but on another line.
I want to get rid of every mouse interaction in vim. I want to be able to select text and paste it with the middle button, just like in the terminal. That's the only thing I use the mouse for. Yes, I use many vi-commands to copy text as well, but sometimes it's easy to copy with a double click and paste with the middle button. But I don't want the cursor to move. This is the way vi always used to work on every unix I've used.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you commented.![]()
Mouse scrolling in the terminal is no problem, as the middle mouse button paste still happens at the cursor. I want the same behavior in vim (like it used to be).
—
Reply to this email directly, view it on GitHub.
You are receiving this because you commented.![]()
Mouse scrolling in the terminal is no problem, as the middle mouse button paste still happens at the cursor. I want the same behavior in vim (like it used to be).
middle mouse button has nothing to do with mouse scrolling. that is a feature of your x-server.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you commented.![]()
I know. But mouse scrolling does.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you commented.![]()
imap imap work fine for me in xterm, xfce4-terminal and GNOME Terminal. For those to work, however, Vim must have control of the mouse, so you can't expect those to work and have :set mouse= which gives control of the mouse to the terminal. Just leave :set mouse=a Regards, Gary
But the silly thing is that with mouse=a, the scrollwheelup/down settings do work. But you get other silly mouse effects (like entering visual mode if you happen to click in the window, or other such silly things).
If mouse= in vim, the scrollwheelup/down settings do not work. And it's not the terminal that handle those. It's vim. If I use xterm or rxvt, the mouse wheel scrolls the content in the window, it does not move the mouse cursor. So it's clear that it's vim that handles the scrollwheel even though mouse=.
I think I'm going to have to checkout the code and have a look if I can make a patch to fix this bug.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you commented.![]()
When Vim doesn't handle the mouse (set mouse=), how the scrollwheel is handled may depend on the terminal.
Some terminals may convert scrollwheel up/down to cursor key up/down. In that case, Vim won't receive ScrollWheelUp/Down events. So,
If mouse= in vim, the scrollwheelup/down settings do not work.
this is the expected behavior.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you commented.![]()
Thank you!! You're correct!!
These fixes the problem:
noremap
inoremap
noremap
inoremap
These disable both the arrow keys and the scroll wheel!!
You can't use the arrow keys, but that's not very important, as hjkl still work. But I'll check if there are settings in the terminal emulator to disable this conversion as well.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you commented.![]()