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

How do I run a single normal mode command without fully leaving insert mode?

Answer

<C-o> (insert mode)

Explanation

Pressing <C-o> while in insert mode lets you execute exactly one normal mode command and then automatically returns you to insert mode. This is faster than pressing <Esc>, running a command, and then pressing i or a to re-enter insert mode.

How it works

  • <C-o> temporarily suspends insert mode
  • You type a single normal mode command (motion, operator, etc.)
  • Vim executes the command and immediately returns to insert mode

Note: only one command is allowed. Multi-key sequences like dw count as one command, but trying to enter a second command will not work — Vim returns to insert mode after the first one.

Example

You are typing and realize you need to delete the previous word without leaving insert mode:

This is a mistke word here
                ↑ cursor here in insert mode

Press <C-o>b to jump back one word, then <C-o>dw to delete it — each <C-o> executes one command and returns to insert mode:

This is a  word here

Or use <C-o>A to jump to end of line while staying in insert mode.

Tips

  • <C-o>zz is a popular idiom to center the screen on your cursor while typing
  • <C-o>D deletes from cursor to end of line without leaving insert mode
  • <C-o>0 jumps to column 1 without leaving insert mode
  • For multiple commands, <Esc> is still better — <C-o> shines for quick single-command interruptions

Next

How do I rename a variable across all case variants (snake_case, camelCase, MixedCase) at once?