Replace a Character

r{char} β€” overwrite one character without entering Insert mode.

Keys: r

r{char} replaces the character under the cursor with {char} and stays in Normal mode. Perfect for fixing a typo without an i…Esc dance.

Typo? Cursor on the wrong letter? r{c} swaps it for {c} and leaves you in Normal mode. No Insert-mode round-trip, no Esc. One change, one keystroke past the new character.

Replace the character under cursor with x
KeyNote
r
x
Replace the next 3 characters with ---
KeyNote
3
r
-
r{char} β€” replace one character

Reference

Key Action
r{c} Replace one character with c
{n}r{c} Replace next n characters with c (repeated)
rEnter Replace with a newline (split line)
R Enter Replace mode (continuous overwrite)
gr{c} Replace virtually (don't extend short lines)

Worked example β€” r x

Replace one character without entering Insert.

Step 1 Β·
editing.replace-char
Step 2 Β· rx Β· rx β€” 'f' becomes 'x'.
rx β€” 'f' becomes 'x'.

r waits for the next keystroke and writes that char in place. No mode change. R enters Replace mode for many chars.

β–Ά Try this in the simulator

See also: Replace Mode, Change