Learn Vim / How to Replace a Single Character in Vim

How to Replace a Single Character in Vim

The answerMove onto the character and press r followed by the new character — no insert mode needed.

Try it on a real buffer

“biat” should be “boat”. You're on the wrong letter — press r then o to replace it without entering insert mode.

i live on a huge biat on the river

Canonical solution: r o · target: 2 keystrokes — the fewest that solve it (every keypress counts).

Why it works

r{char} swaps exactly one character and leaves you in normal mode. For longer overwrites, R enters replace mode (like classic “overtype”).

Variations

KeysWhat it does
r{char}replace one character
Rreplace mode — overtype until Esc
~toggle the case of the character
▶ live vim buffertarget 2 keystrokes
“biat” should be “boat”. You're on the wrong letter — press r then o to replace it without entering insert mode.

Reading about keystrokes doesn't build keystrokes. Try this in a real vim buffer right now — the “One-letter fix” mission takes about a minute.

Sign in free to practice →

Keep going