Skip to content

Instantly share code, notes, and snippets.

@io41
io41 / .rgr.zsh
Last active July 4, 2023 12:47
ripgrep (rg) replace all files inplace, just like sed -i
# install ripgrep & moreutils (for the sponge tool) See https://www.putorius.net/moreutils.html
# On mac: brew install moreutils ripgrep
# Source this file in your zsh config by adding `source .rgr.zsh` to your .zshrc
function rgr() {
local context_lines=2
local search="$1"
local replace="$2"
shift 2