dajva / rg.el

Emacs search tool based on ripgrep
https://rgel.readthedocs.io
GNU General Public License v3.0
471 stars 38 forks source link

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

Open JohnWick95 opened 4 years ago

JohnWick95 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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.

failable commented 2 years ago

Any news of this?

dajva commented 2 years ago

Not been working on this for long.