Skip to content

Instantly share code, notes, and snippets.

@joshuaborn
Created January 6, 2016 18:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshuaborn/5eb74f025c37c20d138c to your computer and use it in GitHub Desktop.
Save joshuaborn/5eb74f025c37c20d138c to your computer and use it in GitHub Desktop.
Find and replace across files in Vim
function GlobalFindReplace(target, replacement)
execute "arg `ag -l " . a:target . "`"
execute "argdo % s/" . a:target . "/" . a:replacement . "/gc | update"
endfunction
command -nargs=* Gfr call GlobalFindReplace(<f-args>)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment