3

This works fine in Linux so I'm wondering if this is a problem with the version of less that the Mac is running.

I have the same ~/.lesskey file set up, lesskey runs successfully in both places, the resulting ~/.less are identical:

ec2-user@domU-12-31-39-0F-D6-5D:~/util 1:13:37
% md5sum ~/.less                                       
0d9f50f079b66b8ef8518940b6674a7e  /home/ec2-user/.less
% less --v                            
less 436
Copyright (C) 1984-2009 Mark Nudelman

And

slu@Stevens-MacBook-Pro:~/util 21:14
% md5 ~/.less                                             
MD5 (/Users/slu/.less) = 0d9f50f079b66b8ef8518940b6674a7e
% less --v                           
less 458 (POSIX regular expressions)
Copyright (C) 1984-2012 Mark Nudelman

the keybindings apply for man use on the Mac as well. It is only when I run git related commands that the less reverts to regular keybindings.

xhienne
  • 5,738
  • 1
  • 15
  • 34
Steven Lu
  • 41,389
  • 58
  • 210
  • 364
  • How can you install lesskey on OSX? I can't find the program on the internet and it doesn't ship with 10.12. – adrian Dec 06 '16 at 20:24
  • I believe the way it works is lesskey is a component of the gnu (binutils?) less package. OSX comes with a BSD flavored less. So you just homebrew your less, and possibly might need to do stuff like I wrote in the answer here, and you get lesskey at that point. Should just work. – Steven Lu Dec 06 '16 at 20:32

2 Answers2

1

Do you have a $LESS environment variable?

According to git-config's man page (core.pager), it will set $LESS to FRSX if unset.
Could this be effecting your set up?

demure
  • 7,337
  • 3
  • 22
  • 17
1

I found the issue!

Git was running /usr/bin/less, but I had set up less from source (And I discovered this issue when it occurred to me that I could install less from homebrew and it made me think).

So, manpages and just running less would run /usr/local/bin/less, but git for whatever reason would grab the original old one, which is not compatible with the lesskey config. /usr/local/bin comes before /usr/bin in my path.

My solution, then, was sudo mv /usr/bin/less /usr/bin/less-old.

Steven Lu
  • 41,389
  • 58
  • 210
  • 364