Refactoring with counsel-ag

Back in January of 2015, I wrote about an excellent post from abo-abo on his refactoring workflow. If you haven’t read his post be sure to take a few minutes to read it. The basic idea was that he wanted to change all occurrences of an identifier in all files in a given directory. He does that by finding each occurrence with rgrep, making the rgrep result buffer writable with wgrep, then using iedit to change all occurrences at once.

Samuel Barreto has a similar workflow that uses counsel-ag. He uses the evil substitution command rather than iedit to make his change but that’s a detail. Take a look at his post for the details. If you’re using ag or looking for a reason to install it, his workflow is very appealing. I wouldn’t be surprised if abo-abo is using it himself now. If you often find yourself making this sort of global change, you really need to check out these workflows.

This entry was posted in General and tagged . Bookmark the permalink.