You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How to turn off mouse (or touchpad) scrolling when running vim in an xterm?

Just updated 13" macbook pro (mid-2010) from Snow Leopard (10.6.8) to Yosemite (10.10.1). Previously, when running vim in an xterm, scrolling with the touchpad did nothing inside vim, it just scrolled the xterm history back so I could see what I had done before executing vim. Now, the same scrolling action (either with touchpad or with an external mouse with scrollwheel) moves the cursor position inside vim (if I'm in navigate mode). I want to turn this feature off. I'm sure some people like it but I do not. Anyone know whether this is something to be blocked by vim settings, or perhaps something in the xterm settings I need to change? Vim version is 7.3 (2010 Aug 15), which must be a slightly later version than I had under the original operating system, since I got it July 2010.


I've tried modifying various vim settings, but to no effect. I haven't found a comprehensive list of such settings to try systematically.

MacBook Pro, OS X Yosemite (10.10.1)

Posted on Nov 29, 2014 3:08 PM

Reply
Question marked as Top-ranking reply

Posted on Nov 30, 2014 7:34 PM

User uploaded file

7 replies

Nov 29, 2014 6:49 PM in response to t301

If that is the case, then it is unlikely Vim.


More likely something is converting mouse/trackpad scroll movements into arrow keys.


This could be a feature of the xterm you are using. What are you using for xterm and X11. Is it XQuarts? Do they have a new release for Yosemite?


I'm still on Mavericks, and XQuarts and xterm behave as expected.


:set mouse=a causes Vim to see mouse/trackpad actions, including clicks, scrolling, click and drag, etc...

:set mouse="" causes mouse/trackpad scrolling just effects the xterm scrollback history, but Vim ignores it.


The only other possibility is that the version of Vim you are using has been customized to always honor mouse/trackpad actions and ignore the Vim mouse option.

Nov 29, 2014 11:02 PM in response to BobHarris

Ah.... I think you just helped me figure it out. Or figured something out. I've been calling it 'xterm' but it is really whatever Terminal.app gives me. When I explicitly start a /opt/X11/bin/xterm (from a Terminal), behavior acts as you suggest: with mouse="", the 2-finger trackpad gesture or a scroll wheel rotation on a mouse scrolls through the xterm history, and with mouse=a it scrolls through the edited file. So whatever has changed has to do with Terminal.app, which does have mostly xterm-like behavior, just not this particular feature anymore. I either figure that one out or just work with true xterm(s). Probably the latter.


Thanks for your authoritative answers. Helped a great deal. - KLT.

Nov 30, 2014 5:53 AM in response to t301

While I do not have Yosemite up and running at the moment, I cannot actually play with Yosemite Terminal.app. But you should at least look through the various Terminal -> Preferences to see if there is any configuration option that is telling the Terminal how to treat scroll operations. And try things like changing the "Declare terminal as: ............." setting, as that may affect the Terminfo database entry, which Vim uses to decide on what it does with various keyboard escape keys for input as well as displaying output (not sure if that would affect scrolling input, but it is worth a shot).


Instead of using X11 and xterm, consider giving iTerm a try. I have been using as my terminal emulator for years, and at work I live in terminal sessions, ssh'ed into various Linux, Solaris, AIX platforms.

<http://iterm2.com> A newer version

<http://iterm.sourceforge.net> an older but still viable version (I used this on my Snow Leopard 10.6.8 system)

iTerm will give you Tabbed windows just like Terminal (actually had Tabbed windows years before Terminal.app). It will allow you to define what a double-click selection thinks is a word. It has an option to automatically load anything selected into the copy/paste buffer.


NOTE: I have nothing against X11 and xterm. I also use X11 (XQuartz) all day as well as terminal sessions, with various Linux, Solaris, AIX X11 displays being sent back to my iMac at work, frequently using gvimdiff.

Apr 19, 2015 11:45 AM in response to t301

Turns out holding Shift while trackpad scrolling reverses the effect. i.e. in vim/man/less Shift will scroll the window history, and where the scrolling history is the default Shift will change the trackpad to sending up and down key presses. Which is a bit annoying, the same keys should always do the same thing irrespective of what command you're in. But anyway, Shift is another way to solve this problem.


More info here: http://www.macissues.com/2014/06/10/yosemite-introduces-per-line-scrolling-in-th e-terminal/


P.S. Any ideas how even when ssh'ed into another machine and you man or less on that box that Terminal knows you're in that app and to flip what the trackpad does?

How to turn off mouse (or touchpad) scrolling when running vim in an xterm?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.