Viewing man pages with scroll wheel support

5,083

Solution 1

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.

Solution 2

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)

Solution 3

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.

Share:
5,083

Related videos on Youtube

Julian
Author by

Julian

Updated on September 18, 2022

Comments

  • Julian
    Julian over 1 year

    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.

    • didierc
      didierc about 9 years
      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?
    • Julian
      Julian about 9 years
      @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.)
    • Sparhawk
      Sparhawk about 9 years
      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.
    • Julian
      Julian about 9 years
      @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.
    • Julian
      Julian about 9 years
      A request is open on the less features page for mouse support, so I'm not sure where it is that it has already been implemented. Compiled the beta too, still doesn't work.
    • Sparhawk
      Sparhawk about 9 years
      @0942v8653 Arch Linux, less v471. It's not aliased to anything. I'm not sure if config options are stored anywhere. I can't see anything strange in ~/.bashrc, but I wonder if the terminal emulator is important. I also just tried ssh-ing into my Debian Raspberry Pi, and it works there too with less v 458.
    • Julian
      Julian about 9 years
      @Sparhawk: Hmm, 471 is the beta version I tried. As long as TERM is xterm-256color, then the emulator shouldn't matter. less configurations might be in environment variables—try echo $LESS<tab>.
    • Sparhawk
      Sparhawk about 9 years
      Hm, that only gives $ echo $LESSOPEN -> |/usr/bin/lesspipe.sh %s. Also, scroll works in (KDE's) konsole, but not xterm (both have $TERM=xterm-256color).
    • Julian
      Julian about 9 years
      @mikeserv: lesspipe is just a preprocessor, so it should not matter. It's possible the emulator is configured to send arrow keys for the scroll wheel in alternate screen mode—that seems to be the easiest option, if yours supports it.
    • Sparhawk
      Sparhawk about 9 years
      @mikeserv FWIW I use bash. Also, as above, it also works over an ssh session (which is also bash), with no X forwarding.
    • mikeserv
      mikeserv about 9 years
      @Sparhawk - do you have that $LESS_TERMCAP_us thing? Cool about the ssh thing - so you think it is less directly handling the mouse escapes or do you also use terminator on the other end of that ssh? If the latter then ssh shouldn't matter too much - I think recall reading somewhere that ssh doesn't do any terminal translation at all (but I don't use it much either).
    • Sparhawk
      Sparhawk about 9 years
      @mikeserv No, echo $LESS + <tab> will only autocomplete to $LESSOPEN. $LESS_TERMCAP_us is empty. I'm not even sure how I could have terminator on the other side, but anyway, it's not installed there.
    • Sparhawk
      Sparhawk about 9 years
      @mikeserv Also, I just tried putting set mouse=a in my server's ~/.vimrc, and now I can mouse scroll over ssh in vim too…
    • Sparhawk
      Sparhawk about 9 years
      @mikeserv Ummm… I'm not sure. I'm not totally sure how ssh works. Is it not going straight into the console?
    • Sparhawk
      Sparhawk about 9 years
      @mikeserv I thought I understood you now, but your last sentence confused me! :) However, I think we are on the same page now. I use terminator to ssh into the server, where my shell is bash. Oooooh… and if I use xterm as the emulator, I can't scroll in man, but I can in vim?! This is the same locally or via ssh.
    • Sparhawk
      Sparhawk about 9 years
      @mikeserv Ah nice. That sounds very interesting!
    • terdon
      terdon about 9 years
      Please edit your question and include your operating system. Since you mention iTerm2, I assume you're on a mac but you need to state that. I've been scrolling with the wheel in less for many years (at least 10) and in at least 4 different Linux distributions.
  • Julian
    Julian about 9 years
    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.
  • Julian
    Julian about 9 years
    I want something that supports xterm mouse escape codes, and as I said, starts at the top.
  • Julian
    Julian about 9 years
    +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.
  • Sparhawk
    Sparhawk about 9 years
    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.
  • Julian
    Julian about 9 years
    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.
  • Sparhawk
    Sparhawk about 9 years
    Ah okay. I just re-read your answer. That makes sense.
  • astorije
    astorije almost 9 years
    Where did you find Advanced in the Preferences of iTerm2?!