Viewing man pages with scroll wheel support
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.
Related videos on Youtube
Julian
Updated on September 18, 2022Comments
-
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 about 9 yearsI 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 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 about 9 yearsThis is definitely possible.
less
andman
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 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 about 9 yearsA 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 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 about 9 years@Sparhawk: Hmm, 471 is the beta version I tried. As long as
TERM
isxterm-256color
, then the emulator shouldn't matter. less configurations might be in environment variables—tryecho $LESS<tab>
. -
Sparhawk about 9 yearsHm, 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 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 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 about 9 years@Sparhawk - do you have that
$LESS_TERMCAP_us
thing? Cool about thessh
thing - so you think it isless
directly handling the mouse escapes or do you also useterminator
on the other end of thatssh
? If the latter thenssh
shouldn't matter too much - I think recall reading somewhere thatssh
doesn't do any terminal translation at all (but I don't use it much either). -
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 haveterminator
on the other side, but anyway, it's not installed there. -
Sparhawk about 9 years@mikeserv Also, I just tried putting
set mouse=a
in my server's~/.vimrc
, and now I can mouse scroll overssh
invim
too… -
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 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
tossh
into the server, where my shell isbash
. Oooooh… and if I usexterm
as the emulator, I can't scroll inman
, but I can invim
?! This is the same locally or viassh
. -
Sparhawk about 9 years@mikeserv Ah nice. That sounds very interesting!
-
terdon about 9 yearsPlease 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 about 9 yearsMy 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 about 9 yearsI want something that supports xterm mouse escape codes, and as I said, starts at the top.
-
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 about 9 yearsI 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 about 9 yearsThat'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 about 9 yearsAh okay. I just re-read your answer. That makes sense.
-
astorije almost 9 yearsWhere did you find Advanced in the Preferences of iTerm2?!