5

I'd like to use the scroll wheel (xterm mouse escape codes) to scroll through man pages, like I can in emacs with xterm-mouse-mode. less doesn't seem to have support for that and short of recompiling it I can't find a way to add it.

Is there a different pager I could use that supports the scroll wheel (or a way I could get less to do it)? I'd rather not give up bold and underline if possible.

My emulator is iTerm2 on Mac OS X Yosemite, if that helps.

  • 1
    I am a little confused by your question, because usually terminals already have a scrolling support in place to look at past output, so how would your system interact with the terminal exactly? Would it override the existing one for the duration of the pager runtime? – didierc Feb 13 '15 at 1:33
  • @didierc: I'm not sure about the specifics, but basically it would use whatever escape code it is to tell the terminal that the alternate screen buffer supports xterm mouse codes and to report them to the program. I think both emacs and vim support them. (Quick edit: it's called alternateScroll.) – 0942v8653 Feb 13 '15 at 2:21
  • 3
    This is definitely possible. less and man scroll for me with the scroll wheel (in terminator). Unfortunately, I can't remember what I changed, if anything. This might be useful, but I can't understand where to set options. – Sparhawk Feb 13 '15 at 2:25
  • @Sparhawk: What's your setup? Distro? coreutils? My less version is 418. I compiled less 458 and that didn't help, so it might be something else. – 0942v8653 Feb 13 '15 at 2:28
  • 1
    @mikeserv FWIW I use bash. Also, as above, it also works over an ssh session (which is also bash), with no X forwarding. – Sparhawk Feb 13 '15 at 4:24
0

you can use cat

man --pager=cat <page>

or you can pipe the man page into cat

man <page> | cat
  • 1
    My version of man (on a Mac) doesn't work with --pager, but more importantly cat starts at the end of the document and there's no easy way to get up to the top. – 0942v8653 Feb 13 '15 at 1:01
  • 1
    I want something that supports xterm mouse escape codes, and as I said, starts at the top. – 0942v8653 Feb 13 '15 at 1:02
1

It seems this is possible using WoMan in Emacs.

According to http://www.emacswiki.org/emacs/WoMan “woman” stands for “w/o man”, ie “without man” and allows you to view man pages without having the “man” program installed.

In Emacs enter:

M-x woman

Where M-x is the Alt key followed by the letter x.

You will then be prompted to specify the man page you wish to view.

  • +1, this is helpful, but I'm really looking for an alternative pager. If there's nothing else I can use that, but I'd really rather stick to stock man. – 0942v8653 Feb 13 '15 at 2:40
3

I set my terminal emulator to send arrow keys for the scroll wheel when in alternate screen mode.

In iTerm2, that's under Preferences > Advanced and search for "scroll".

It doesn't interfere with xterm escape codes when something supports it, but when it does not (like in less), it sends arrow keys instead. Still not a complete solution, but better than nothing. (I think that's what Sparhawk's terminator was doing in the comment section above)

  • I don't know how it works, but my scroll wheel is definitely not just sending arrow keys. For example, in vim, scroll wheel scrolls the page, and arrows move cursor position. – Sparhawk Feb 14 '15 at 10:58
  • That's because vim supports the scroll wheel. For me emacs is the same way—even when I turned that on, it worked the way it always has. – 0942v8653 Feb 14 '15 at 13:02
  • Ah okay. I just re-read your answer. That makes sense. – Sparhawk Feb 14 '15 at 13:13
  • Where did you find Advanced in the Preferences of iTerm2?! – astorije Jul 6 '15 at 9:31
3

w3m can be a decent pager (though I do prefer less). It supports the mouse (you may need to enable this in the configuration), including scrolling.

Vim is a text editor but can be used as a pager: set PAGER='vim -R'. You can enable mouse support with set mouse=a in your ~/.vimrc. The wheel works at least in xterm, I can't vouch for OSX's terminal emulator.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.