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

Searching in a single file or the current file is awkward #91

Open
JohnWick95 opened this issue Jul 4, 2020 · 5 comments
Open

Searching in a single file or the current file is awkward #91

JohnWick95 opened this issue Jul 4, 2020 · 5 comments
Milestone

Comments

@JohnWick95
Copy link

When using Regex or Literal search is not clear that you can type the file name in the file filter prompt (works by coincidence?) but it works, no file navigation help(completion) though.

When using the 'Current file' option one can't specify the search pattern before the search because it searches the current 'word' under the cursor, so you have to then redefine the search.

Maybe I'm missing something or this is not a use case rg.el cares about much?

Tangential: The readme implies grep can only search one file but it can search many. Of course you know this, maybe you meant to say ripgrep is better optimized for search multiple files?

Anyway, best emacs ripgrep interface, thx!

@dajva
Copy link
Owner

dajva commented Jul 4, 2020

Thanks!

Yes, you are right that the single file search has never been a prioritized use case for this package. The rg-dwim-current-file search function is not a true one file search function but rather search all files with this name under a specific directory. I think this is mentioned somewhere in the docs or at least I have thought about adding it. :)

This essentially comes from that this package grew as a replacement for the rgrep emacs command which is my personal primary use case. I have struggled with finding a good way of adding true single file search into this package and fit with the other concepts. I actually have a prototype on the search_buffers branch that adds a path filter concept that is intended to be used for single file search (among others). No such frontend atm but if you want to play with it it should be possible to create one with the rg-define-search macro pretty easily.

Tangential: The readme implies grep can only search one file but it can search many.

This is unintentional. If you point me at the passage I will try to fix that.

@dajva
Copy link
Owner

dajva commented Jul 4, 2020

No such frontend atm but if you want to play with it it should be possible to create one with the rg-define-search macro pretty easily.

This is not entirely true I realize. You would also have to modify the rg-path-filter-functions option properly so it gets a bit more tricky I am afraid.

@JohnWick95
Copy link
Author

Thanks, Not much of a problem, we'll see what can I work out.

This is unintentional. If you point me at the passage I will try to fix that.

At the top of the README:

Ripgrep is a replacement for both grep like (search one file) and ag like (search many files) tools.

@dajva dajva added this to the 2.1.0 milestone Sep 5, 2020
@dajva dajva modified the milestones: 2.1.0, 2.2.0 Jun 25, 2021
@failable
Copy link

Any news of this?

@dajva
Copy link
Owner

dajva commented Sep 29, 2021

Not been working on this for long.

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

3 participants