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

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

Answer

<C-o>{cmd}

Explanation

Pressing <C-o> in insert mode lets you execute one normal mode command and then automatically returns you to insert mode. This eliminates the <Esc> → command → i round trip for quick one-off actions like scrolling, deleting a line, or jumping to a mark while you are in the middle of typing.

How it works

  • While in insert mode, press <C-o>
  • Vim temporarily enters a special "insert-normal" mode (shown as -- (insert) -- in the status line)
  • Execute any single normal mode command — a motion, an operator+motion combo, or a command like zz
  • After the command completes, Vim automatically returns to insert mode at the same cursor position

Example

You are typing in insert mode and realize the line you're working on is at the very bottom of the screen. Instead of pressing <Esc>zzi, just press <C-o>zz — the screen recenters on your cursor and you stay in insert mode, cursor unmoved.

More examples while staying in insert mode:

<C-o>dd       " Delete the current line
<C-o>O        " Open a new line above (then you're in insert on the new line)
<C-o>zz       " Center the screen on the cursor
<C-o>$        " Jump to end of line
<C-o>0        " Jump to beginning of line
<C-o>D        " Delete from cursor to end of line
<C-o>p        " Paste after the cursor
<C-o>u        " Undo the last change
<C-o>'a       " Jump to mark a
<C-o>:w<CR>   " Save the file

Tips

  • <C-o> only runs one command — after it completes, you are back in insert mode. If you need multiple commands, use <Esc> instead
  • The single command can be a compound operator+motion like <C-o>daw (delete a word) or <C-o>3j (move down 3 lines) — the entire operator counts as one command
  • <C-o> works with Ex commands too: <C-o>:w<CR> saves the file without leaving insert mode
  • Use <C-o> with <C-r> for a powerful combination: <C-o>"ayiw yanks the word under the cursor into register a while staying in insert mode
  • This is different from <C-o> in normal mode (which navigates the jumplist) — context determines which <C-o> you get
  • If you find yourself using <C-o> frequently for the same action, consider creating an inoremap mapping instead
  • The cursor briefly shows as a block (normal mode cursor) during the command and returns to the line cursor (insert mode) after completion

Next

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