vimtricks.wiki Concise Vim tricks, one at a time.

How do I overwrite existing text character by character without deleting first?

Answer

R

Explanation

Replace mode lets you type over existing text one character at a time, like the "Insert" key behavior in traditional editors. Press R in normal mode to enter Replace mode, then every character you type overwrites the character under the cursor instead of inserting before it.

How it works

  • R enters Replace mode from normal mode
  • Each keystroke replaces the character under the cursor and advances to the next
  • <Backspace> restores the original character (unlike delete)
  • <Esc> returns to normal mode
  • The entire Replace session counts as one undoable change

Example

Given the text with the cursor on H:

Hello World

Press R then type Jelly:

Jelly World

The first five characters were overwritten in place without shifting the rest of the line.

Tips

  • Use r (lowercase) to replace a single character and immediately return to normal mode — R stays in Replace mode
  • gR enters Virtual Replace mode, which treats <Tab> as screen columns rather than a single character, preserving alignment
  • Replace mode respects <Backspace> specially: it restores the original character rather than deleting, so you can "undo" within the session
  • Combine with a count: 5rx replaces the next 5 characters with x
  • Replace mode is ideal for editing fixed-width data like tables, columns, or aligned comments

Next

How do I edit multiple lines at once using multiple cursors in Vim?