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

How do I use the caret mark to jump to the exact cursor position where I last left insert mode?

Answer

'^

Explanation

Vim automatically maintains a special mark ^ that records the exact position of the cursor the last time you left insert mode. Pressing '^ (tick-caret) in Normal mode jumps to that position. Unlike gi which jumps there and immediately re-enters insert mode, or `. which marks the position of the last change, '^ gives you a way to jump back as a plain mark — useful for combining with operators or making multiple visits without unintentionally re-entering insert mode.

How it works

  • ^ is one of Vim's automatic marks — you never set it manually
  • It updates every time you leave insert mode with <Esc>, <C-c>, or <C-[>
  • '^ (tick variant) moves to the beginning of the line containing the mark, then to the column; actually '^ moves to the exact character column (same as backtick version for this mark)
  • `^ (backtick variant) also works and is equivalent here — both go to the exact cursor position

Example

You are editing a long function, leave insert mode somewhere in the middle, navigate around to read other code, then want to return without restarting insert:

  1. You leave insert mode with <Esc> on line 42, column 18
  2. You use /search, G, and % to navigate elsewhere
  3. Press '^ to jump back to line 42, column 18
  4. When you're ready to type again, press i or a

Compare with gi which does steps 3 and 4 in one keystroke — '^ is useful when you want to inspect the position before committing to insert mode.

Tips

  • Use gi when you want to jump back and immediately resume typing — it is shorthand for `^i
  • Use '^ when you want to jump back without entering insert mode, for example to yank or inspect text nearby
  • The mark persists across file switches; if you were editing a different buffer, '^ will switch back to that buffer at the insert position
  • View all automatic marks with :marks — the ^ mark appears in the list alongside ., [, ], <, and >

Next

How do I use a count with text objects to operate on multiple text objects at once?