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

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

Answer

<C-o>{command}

Explanation

While typing in insert mode, you sometimes need to do a quick normal-mode action — center the screen, jump to a mark, or delete a word backward. Instead of pressing <Esc>, executing the command, and pressing i to re-enter insert mode, <C-o> lets you execute exactly one normal-mode command and immediately returns to insert mode.

How it works

  • <C-o> — temporarily switch to normal mode for exactly one command
  • After the command executes, Vim automatically returns to insert mode at the same cursor position
  • The mode line shows -- (insert) -- to indicate this transient state

Example

You are typing in insert mode and realize the line you need is off-screen:

" While in insert mode, center the current line on screen:
<C-o>zz

" Delete the word before the cursor without leaving insert mode:
<C-o>db

" Jump to the top of the file, then right back to insert mode:
<C-o>gg

" Indent the current line:
<C-o>>>

Tips

  • <C-o> works with any single normal-mode command, including motions, operators, and even commands like u (undo)
  • For multiple normal-mode commands, use <C-o> repeatedly or just use <Esc>
  • Combine with <C-o>O to open a new line above while staying in insert mode
  • This is especially powerful when combined with zz, zt, zb for scrolling while typing

Next

How do I return to normal mode from absolutely any mode in Vim?