Perform a global replacement across the buffer.

Section: Substitution patterns

Substitute in entire file

vim
vim
:%s/old/new/gc
Explanation

Add `c` to confirm each replacement interactively.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Substitution patterns
Substitute on current line
Replace matches only on the current line.
OpenIn sheetvimsame section
Substitute inside visual selection
Restrict replacement to a selected range.
OpenIn sheetvimsame section
Clear search highlight
Remove visual search highlighting.
OpenIn sheetvimsame section
Search forward
Find the next match after the cursor.
OpenIn sheetvim1 tag match
Record a macro
Start recording keystrokes into a register.
OpenIn sheetvim1 tag match
Search backward
Search upward through the file.
OpenIn sheetvim1 tag match