You are not logged in.

#1 2008-11-06 03:43:27

From: Detroit, MI
Registered: 2008-09-05
Posts: 116

Use Mouse Wheel in man/less

I can scroll with the mouse wheel in xterm when I use standard command output and whatnot, but I can't figure out how to scroll through man pages with the scroll wheel.  Thoughts?

Last edited by MarCustomized (2008-11-06 03:43:58)


#2 2008-11-06 11:33:49

Registered: 2008-05-07
Posts: 1,819

Re: Use Mouse Wheel in man/less

Use mcview.

Or maybe most? It's got more features, I dunno if scroll wheel is one of them.

Here's an mcview script, it needs mc of course

#! /bin/bash
for program in $(whereis $1); do [[ $program =~ .*man/.* ]] && mcview $program; done


#3 2008-11-06 13:06:54

Registered: 2006-11-27
Posts: 443

Re: Use Mouse Wheel in man/less

I just spent 20 minutes digging in the manuals for urxvt and lesskey because I realized I'd also like something like this. The bad news it, it isn't going to (easily) happen without patching less (or simply using another pager; most and mcview are good). The rest of this post is technical detail you probably don't need unless you're more persistent than I am.

Xterm-compatible terminals don't send mouse events by default. That can be worked around by sending the appropriate control sequences ('\e[?9h' and '\e[?9l') before and after (respectively) running less. A quick shell function could automate this. The larger problem is that there's no way to get just the button pressed: it also sends the coordinates of the pointer at the time of the click. You can tell less to scroll based on events by entering the appropriate sequences in your ~/.lesskey file and running lesskey (see `man lesskey`). As these sequences include the coordinates, you would need to have a line for every permutation. Without poking around the source I don't even know if less can handle that many bindings.


Board footer

Powered by FluxBB