2

The less viewer allows some customization using the ~/.lesskey file, but it does not seem to have any effect in the context of searching. For example, I can map ^P to the up arrow, and this works for navigating, but as soon as I press / and begin a search, less completely forgets about all my customizations and instead puts a warty ^P in the search string.

Is there any way to enable shortcuts during search, so that for example I can access previous searches using ^P instead of an arrow key that is very far out of reach from my typing position?

1 Answer 1

2

If you want customise shortcuts for the line editor, you have to put it in a #line-edit section in ~/.lesskey:

#line-edit
^P up
^N down

See man lesskey for details.

1
  • 1
    Thanks, I read man lesskey many times over, but I assumed that #any-text could only possibly be a comment, since that is the common convention. Feb 1, 2022 at 19:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .