Replace matches only on the current line.
Section: Substitution patterns
Substitute on current line
vim
vim
:s/old/new/gExplanation
The `g` flag replaces all matches on the current line.
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