Replace all matches on a line
:s/old/new/g
Example
Normal 0 / 2Command-line 1 / 2Normal 2 / 2old oldCursor on line 1, column 1old oldCursor on line 1, column 1new newCursor on line 1, column 1Replace every old match on the current line.
Command entered · ready to apply
Replace every old match on the current line
Before & after
old oldCursor on line 1, column 1new newCursor on line 1, column 1Start in Normal mode. Cursor starts anywhere on the only line. Execute :s/old/new/g and press Enter.
Details & Vim help
Example replayed in Vim
Replace every old match on the current line.
The g flag normally replaces all matches in each addressed line. This example assumes gdefault and edcompatible are off. It changes only the current line because no range is given.