walles / moar

Moar is a pager. It's designed to just do the right thing without any configuration.
Other
587 stars 17 forks source link

Feature request for pattern search like VIM #72

Closed ciscohack closed 2 years ago

ciscohack commented 2 years ago

Hi Team,

Can we have pattern search feature in moar like we have in vim where we use :g/pattern to match the keyword and list all the lines match to search pattern then we use vim jump feature to jump on the matched line

Second issue i have noticed when i try to search any keyword in moar by click / the search box appear then if any keyword which i have selected and wants to paste. i am not able to do it. I have to type the search keyword all time. Thanks

walles commented 2 years ago

For the first issue, I don't see the upside compared to:

  1. Search for pattern using /
  2. Press Return to exit search mode
  3. Press n repeatedly until you get to the right place

If you think there's an obvious use case here, can you explain in more detail how the vim way would be an improvement over ^?

For the second issue, is there an answer for you in the Workarounds section of #53?

Third, I'm a person not a team :)

ciscohack commented 2 years ago

@walles I am currently doing search through / only but with :g/pattern one will able to list only the line matches to searched keyword but with / it will search all the file line by line.

Second alt key is working for me also to copy the selection but in search field i am not able to paste it.

walles commented 2 years ago

I can confirm that pasting into the search field doesn't work.

Can you open a separate issue for that? I'd like to be able to treat these two issues separately.

ciscohack commented 2 years ago

Sure and thanks

walles commented 2 years ago

@walles I am currently doing search through / only but with :g/pattern one will able to list only the line matches to searched keyword but with / it will search all the file line by line.

I understand what you want, I just don't see how it would be worth any effort on my part.

Do you have a concrete usecase like this (bonus points for attaching the file you are searching ing)?

ciscohack commented 2 years ago

@walles I am currently doing search through / only but with :g/pattern one will able to list only the line matches to searched keyword but with / it will search all the file line by line.

I understand what you want, I just don't see how it would be worth any effort on my part.

Do you have a concrete usecase like this (bonus points for attaching the file you are searching ing)?

  • I'm searching x.txt, see attachment
  • I can use / to search this file for laestrygon, but I don't like it because of $REASON
  • In my case, first listing all hits and then picking a line would be better because of $REASON2

File what i am using can't be shared but anyway i used this .g/pattern option and i liked it in some cases where i am just willing to render only lines having my searched pattern match. with / option i have to search then hit N for all occurance. so thought to have both options would be good. You can close this thread and you can test :g/pattern in any of your file to see the results.

walles commented 2 years ago

Two suggestions which are not exactly what you're asking for, but at least related:

List all matches to the console

grep pattern file.txt

List all matches in moar

grep pattern file.txt | moar

I will close this thread for now.