Is there a way to search, while I'm typing in less
? Just like the vim option, set incsearch
.
As I didn't find a proper way to do it, is there any similar tool that can do it?
lesssearch
Is there a way to search, while I'm typing in less
? Just like the vim option, set incsearch
.
As I didn't find a proper way to do it, is there any similar tool that can do it?
Best Answer
You can do a search from the command line:
Or, once inside
less
, use/
followed by your pattern to do interactive searching (forwards).n
andN
repeat the search in the forward and reverse direction, respectively. That's the bare minimum you need to know; there are many more commands for more complex or specific searches.Edit: To respond to your updated question, there's currently no way to do immediate incremental searching with
less
. Have you considered usingview
instead (opens Vim in read-only mode, so will use yourincsearch
setting)? Vim can be made even more pager-like with the vimpager script.Some additional information: There is an open bug on the Ubuntu bug-tracker for incremental search support, but it doesn't look like it's going anywhere soon. Somebody has implemented incremental support on a github fork, but obviously you're going to have to compile a custom
less
to use that.(And apart from the Ubuntu enhancement request there is currently (as of 2016-05-17) no such enhancement request on the official
less
bugtracker.)