Question

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.

Was it helpful?

Solution 2

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.

OTHER TIPS

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?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top