Replace a Character
r{char} β overwrite one character without entering Insert mode.
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.
| Key | Note |
|---|---|
| r | |
| x |
| Key | Note |
|---|---|
| 3 | |
| r | |
| - |
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.
r waits for the next keystroke and writes that char in place. No mode change. R enters Replace mode for many chars.
See also: Replace Mode, Change