dajva / rg.el

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

Q: Hide command in *rg* buffer #25

Closed Luladjiev closed 6 years ago

Luladjiev commented 6 years ago

Hello I have a question

Is there a way to hide the command that is run with ripgrep. I mean this:

rg --color always --colors match:fg:red -n --type js --fixed-strings --no-heading --type-add gn\:*.gn --type-add gn\:*.gni --type-add gyp\:*.gyp --type-add gyp\:*.gypi -e someTestString .

The problem is that if you search with rg.el then if you want to replace the searched string with wgrep the replace will match the someTestString from the command and it will prevent the replacing with Text is read-only.

Before replacing: image

After replacing - Text is read-only image

dajva commented 6 years ago

Thanks for the report. The command line comes from compilation-mode which rg-mode inherits from. I don't think it is easy to remove (and it's also quite userful). I think this is a bug in wgrep. I see the same behavior when trying the same with rgrep. However this works fine when integrating with wgrep-ag AFAICT. In the non grouped result view I see the same highlights as you but the one in the command line is skipped when the replace happens. Try adding this to your init.el and see if it resolves your issue:

(add-hook 'rg-mode-hook 'wgrep-ag-setup)
dajva commented 6 years ago

You need to install wgrep-ag of course for the above to work.

Luladjiev commented 6 years ago

Thanks for your response. As you point out that this is a wgrep issue I dig in their docs and found that when you enter wgrep mode there is a keybinding C-c C-p that toggles read-only mode that fixes this problem: wgrep.el#L545 Closing the issue

Cheers