Enhancements for deadgrep-edit-mode
hjudt opened this issue · 3 comments
Please consider adding C-x C-q to deadgrep-mode-map as default keybinding for activating deadgrep-edit-mode. dired uses this for enabling editing dired buffers, so it would feel natural to have this.
Also add C-c C-c to deadgrep-edit-mode-map to perform the changes, or C-c C-k to abort them, restoring the previous state. This would be similar to magit and other tools, and wgrep uses C-c too. Aborting the changes and restoring the previous state probably needs to be implemented first.
Finally, refreshing the buffer often returns the results in a different order. I assume this is because rg does a multi-threaded search. However, sometimes it would be less confusing if the order of the results stayed the same. rg itself has options for this (--sort and --sortr), though it probably makes search slower because single-threaded.
Of course, one can achieve C-x C-q and C-c C-c in e.g. the use-package definition:
(use-package deadgrep
:ensure t
:bind (("C-c g" . deadgrep)
:map deadgrep-mode-map
("C-x C-q" . deadgrep-edit-mode)
:map deadgrep-edit-mode-map
("C-c C-c" . deadgrep-mode)))
Unfortunately, there will be no feedback when saving the changes and returning from deadgrep-edit-mode to deadgrep-mode.
As far as I can tell, the updating of files happens as you are typing in deadgrep-edit-mode
rather than when you exit deadgrep-edit-mode
. I find this a little scary and different, but it does mean that feedback from exiting deadgrep-edit-mode
is less important.
EDIT: Ah, I see that you probably knew this already. Sorry for the noise.
this is unsolicited feedback, but coming to deadgrep
from some other things, I was definitely taken aback when the changes happened without a final "save" step - some other things I've used intercept C-x C-s
to actually save the changes to the files (and also save the buffers to disk). That interface seemed a lot more intuitive to me.