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

How do I jump to the position of my last edit?

Answer

`.

Explanation

The `. command jumps the cursor to the exact position where you made your last change in the current buffer. This is one of Vim's most underused navigation commands, letting you instantly return to where you were just editing without searching or scrolling.

How it works

  • ` is the "go to mark" command (jumps to a specific line and column)
  • . is a special automatic mark that Vim sets at the position of the last change
  • Together, `. moves the cursor to the exact line and column of your most recent edit

Example

You are editing a function on line 42. You scroll up to line 10 to check something. Now you want to return to where you were editing.

Press `. and the cursor jumps back to line 42, landing on the exact column where you last made a change.

Related marks

Vim maintains several automatic marks:

  • `. — position of the last change
  • `" — position where you left the cursor when you last exited the file
  • `^ — position where insert mode was last stopped
  • `[ — start of the last changed or yanked text
  • `] — end of the last changed or yanked text

Tips

  • Use '. (single quote instead of backtick) to jump to the line of the last change without going to the exact column
  • Use gi to jump to the position of the last insert and enter insert mode — this is often even more useful than `.
  • Use g; to step backward through the change list — a history of all change positions. Use g, to step forward.
  • Use :changes to view the full change list with line numbers
  • The change list is separate from the jump list (<C-o> / <C-i>), so these navigation methods complement each other
  • The `. mark is per-buffer, so each file has its own last-change position

Next

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