- Basic Substitution: Using
:s
to replace the first occurrence of text on the current line. - Replacing Text on Specific Lines: Employing
:s
with line numbers or ranges (e.g.,:90,110s
) to replace text within defined line ranges. - Global Substitution: Utilizing
:s
with theg
flag (:s/pattern/replacement/g
) to replace all occurrences of text on a line or throughout the file. - Pattern-based Substitution: Using regular expressions with the substitute command. For instance, replacing the first character of each word with its uppercase representation using
:%s/^./\u&/g
.