PracticalVim Tip96 - yszheda/wiki GitHub Wiki

Table of Contents

Tip 96: Find and Replace Across Multiple Files

Return to the top: <>

Example: find and replace to change each occurrence of "Pragmatic Vim" to "Practical Vim" in each txt file.

The Substitute Command

Execute a Substitute Command on All Files in the Current Project

Build a List of Files Containing Our Target Pattern

  • Each match returned by vimgrep is recorded in the quickfix list, and we can browse the results by running `:copen`, which opens the quickfix window.
  • qargs.vim

* using qargs.vim

* `:update` saves the file, but only if it has been changed

References:

* the last three commands could be combined into one

* On Vim’s command line, `|` simply stands for a command separator, making it equivalent to the semicolon in the Unix shell.

References:

⚠️ **GitHub.com Fallback** ⚠️