editing

r / R

r replaces the single character under the cursor with the next key you press — no need to enter insert mode. Capital R enters REPLACE mode, where every character you type overwrites the one under the cursor until Escape.

r{char}   R  (normal mode)

Variations

Keystroke Effect
3ra Replace the next 3 characters with 'a' → aaa
r<Enter> Replace character with a newline (splits the line)
R Enter full replace mode (overwrites as you type)
gR Virtual replace mode — treats tabs as spaces so layout doesn't shift

Examples

rx

Replace character under cursor with 'x'

5r-

Replace next 5 characters with dashes

Rabc<Esc>

Enter replace mode and overwrite the next 3 characters with 'abc'

Gotcha

Backspace in R replace mode UNDOES the replacement (restores original char), not deletes — surprising if you're used to overwrite editors.

Related

← All Vim commands · Vim cheat sheet