I'd like to swap RETURN (scroll forward N lines, default one window) and SPACE (scroll forward N lines, default 1) in less to get a for me more natural way to page through man pages.

I saw years ago a colleague having this setup during a telnet session to a router while he was skimming through a config file, so I don't actually know if this setting was on his SSH client, on the node or wherever.

Anyway, I'd like to achieve this to the most extent possible, be it locally or remotely.

I checked less man page's key bindings section and found a reference to lesskey.

Unfortunately, Darwin doesn't have this program.


You could install less via MacPorts or homebrew (or Fink!?), MacPorts at least has a lesskey containing less package:

% sudo port install less
% rehash
% which lesskey

This would then require PATH changes or a function for less so the ports-installed version of less gets picked up before the OS one, e.g.

function less {
  /opt/local/bin/less "$@"
  • I'll consider it, but I thought there might be a broader solution, like modifying the term file — still searching… – 1.61803 Sep 13 '15 at 16:05

Since Darwin lacks lesskey (see here and here) I installed less 458 via MacPorts and added the bindings using the defaults path for my system. lesskey will take $HOME/.lesskey and output $HOME/.less. You can also use LESSKEY or LESSKEY_SYSTEM.

~ $ vi .lesskey
\n        forw-screen
\40       forw-line
~ $ lesskey
~ $ ls -d .less*
.less       .lesshst    .lesskey

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.