0

I use / for search. Once I press enter I use n and N to navigate. If I press / again though the old pattern is lost. 90% of the times I want to append the pattern and I have to retype, which I naturally hate it. Is there an option to append the current pattern in less?

6

less remembers previous searches (even from previous executions, if you have a history file — ~/.lesshst by default). To access them, press / and the arrow keys. For your specific use-case, you’d press / , less will show the previous pattern with the cursor at the end of the pattern, and you can type the additional pattern.

  • 1
    So simple and yet, it didn't cross my mind... Thanks. (8 minutes to go) – Stelios Adamantidis Jan 26 '18 at 14:29

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.