Skip to content

Instantly share code, notes, and snippets.

@yevhenorlov
Last active May 14, 2018 08:53
Show Gist options
  • Save yevhenorlov/6e8bbcfacafe27a624547cb023ad3404 to your computer and use it in GitHub Desktop.
Save yevhenorlov/6e8bbcfacafe27a624547cb023ad3404 to your computer and use it in GitHub Desktop.
project-wide search and replace in vim
  1. Set up search scope with :args command (populates vim's arguments list):
selects all .vue files recursively

:args **/*.vue
  1. (optional) View arguments list with :args, add/remove with :argadd and :argdelete respectively

  2. run command for every file in args list with :argdo:

search and replace pattern (c flag for confirmation before substitution),
then save file if it was changed

:argdo %s/search/replace/gc | update

source: https://vi.stackexchange.com/a/2777

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment