Replace the first match on a line
:s/old/new/
Example
Normal 0 / 2Command-line 1 / 2Normal 2 / 2old oldCursor on line 1, column 1old oldCursor on line 1, column 1new oldCursor on line 1, column 1Replace the first old match on the current line.
Command entered · ready to apply
Replace the first old match on the current line
Before & after
old oldCursor on line 1, column 1new oldCursor on line 1, column 1Start in Normal mode. Cursor starts anywhere on the only line. Execute :s/old/new/ and press Enter.
Details & Vim help
Example replayed in Vim
Replace the first old match on the current line.
Enter this Ex command from Normal mode and press Enter. The pattern is a regular expression. This example assumes gdefault and edcompatible are off; gdefault reverses the meaning of g, while edcompatible can retain the prior g/c settings.