nvim-telescope / telescope-live-grep-args.nvim

Live grep with args
726 stars 40 forks source link

Support find-replace #77

Open dudicoco opened 8 months ago

dudicoco commented 8 months ago

Is your feature request related to a problem? Please describe. It would be nice to use telescope as a one stop shop for both finding and replacing content in files.

Describe the solution you'd like rg has the --replace flag which allows replacing the match, a key binding which would then perform the actual replacement is needed as a final step.

Additional context Screenshot 2024-02-15 at 20 40 50

LLMChild commented 3 months ago

wow, did't know that before. Adding a short cut to add --replace is quite simple, but how to render the diff preview of origin/replace? Is there any idea?

weeman1337 commented 3 months ago

Interesting idea :thinking:

Unfortunately ripgrep doesn't support replace. From the man page

-r REPLACEMENT, --replace=REPLACEMENT
           Replaces every match with the text given when printing results. Neither this flag nor any other ripgrep flag will modify your files.