How to you get an app running in Terminal to scroll properly (as on Ubuntu)

terminal

Example: In Terminal, I fire up elinks and browser to a web page. I try to use the trackpad scroll gesture and the page up and page down to scroll up and down the web page that elinks is showing me. But instead of scrolling the web page, Terminal scrolls the entire scrollback buffer.

In Ubuntu, elinks will scroll properly when you press page up and page down and the scrollwheel.

This also applies to other console-based POSIX programs like Vim.

Any suggestions on how to get these programs to accept trackpad scroll gestures in OS X?

Best Answer

To use a mouse wheel or trackpad to scroll in Terminal.app you'll need to install MouseTerm. After installing MouseTerm you'll need to add set mouse=nicr to your .vimrc file:

echo "set mouse=nicr" >> ~/.vimrc

If you're still not able to scroll in elinks it's possible that it wasn't compiled with GPM (General Purpose Mouse) support. Since elinks isn't a native application to OS X you probably installed through MacPorts or Homebrew. I'd open the "formula" file for elinks /usr/local/Library/Formula/elinks.rb (by default for Homebrew) and verify that --without-gpm isn't anywhere to be found.

Though your question states you want to do this in Terminal.app I'd recommend taking a look at iTerm2 which supports this natively, and has quite a bit more to offer then the stock Terminal app.