I recently discovered an awesome capability of Emacs, where I can use occur
to pull all matching lines into a split window and press e
to enter occur-edit-mode
. In this mode I can do things like replace-string
to modify all of the matching lines in my original buffer.
This only modifies the occurrences, and is fantastic! The best part is that I can see all of the potential changes to the original buffer in a concise, noise-free area.
Shortcoming
This mode does not currently have evil
bindings. I can test my regex by using evil-ex
- I get my lovely red strike-through and expected changes, but entering evil-ex
seems to disable the edit capabilities of the occur-edit-mode
and I'm left with a read-only buffer.
Current Workflow
I'm modifying 20+ large files with many rewrite rules and have come up with the following:
eshell
to create a grep buffer across all relevant files.:
(evil-ex
) in the grep bufferThis is not perfect because the regex applies to the original buffer as a whole, not only the matching lines, but so far it's a huge time saver!
Does anyone have a better workflow?