Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request for pattern search like VIM #72

Closed
ciscohack opened this issue Oct 2, 2021 · 7 comments
Closed

Feature request for pattern search like VIM #72

ciscohack opened this issue Oct 2, 2021 · 7 comments

Comments

@ciscohack
Copy link

ciscohack commented Oct 2, 2021

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
Copy link
Owner

walles commented Oct 2, 2021

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
Copy link
Author

@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
Copy link
Owner

walles commented Oct 4, 2021

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
Copy link
Author

Sure and thanks

@walles
Copy link
Owner

walles commented Oct 4, 2021

@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

@ciscohack
Copy link
Author

@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
Copy link
Owner

walles commented Oct 4, 2021

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.

@walles walles closed this as completed Oct 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants