←back to thread

131 points tomschafer | 3 comments | | HN request time: 0.448s | source
1. gurgeous ◴[] No.42149337[source]
Also see the excellent https://github.com/your-tools/ruplacer.

For more advanced needs, I have a custom thing called greprep that let's you make changes using your favorite editor. Workflow is like this:

  1. $ rg -n .... > /tmp/lines.txt
  2. (edit lines.txt in vscode)
  3. $ greprep /tmp/lines.txt to apply the changes
replies(2): >>42149389 #>>42149718 #
2. ◴[] No.42149389[source]
3. jmarcher ◴[] No.42149718[source]
In Emacs, there is [helm-ag-edit](https://github.com/emacsorphanage/helm-ag) (but uses ripgrep if present). It's almost identical to your workflow, but all done inside the same app.

1. helm-ag <pattern> # the search results are updated as you type 2. helm-ag-edit # edit the search result as regular text. Use multi-cursors, macros, whatever. 3. helm-ag-edit-save # commits the changes to the affected files

All those commands have keybindings, so it's pretty fast. I'll often open up Emacs just to do that and then go back to my JetBrains IDE.