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

Q: Hide command in *rg* buffer #25

Closed
Luladjiev opened this issue Nov 17, 2017 · 3 comments
Closed

Q: Hide command in *rg* buffer #25

Luladjiev opened this issue Nov 17, 2017 · 3 comments
Labels

Comments

@Luladjiev
Copy link

Luladjiev commented Nov 17, 2017

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

dajva commented Nov 18, 2017

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

dajva commented Nov 18, 2017

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

@dajva dajva added the question label Nov 18, 2017
@Luladjiev
Copy link
Author

Luladjiev commented Nov 18, 2017

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

dajva added a commit that referenced this issue May 1, 2018
This solution is essentially copied from emacs grep.el
The possibility to hide command line is always on but the default
behavior is controlled by rg-hide-command defcustom.

Related to #25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants