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

How do I jump to the exact position of my last edit in the current buffer?

Answer

.

Explanation

The backtick-dot motion (`.) jumps to the exact line and column where the last change was made in the current buffer. Unlike g; (which walks back through the full change list), this is a single mark that always points to the most recent edit, giving you instant zero-overhead navigation back to where you were working.

How it works

Vim maintains a set of special read-only marks that are updated automatically:

  • `. — jump to the exact position (line and column) of the last change
  • '. — jump to the line of the last change (first non-blank column)
  • `^ — jump to where insert mode was last exited

The backtick variant preserves the column, which is almost always what you want when returning to in-progress work.

Example

You are editing a function signature on line 42, column 18. You scroll away to read some other code (using gg, search, etc.). To snap back to the exact character you were on:

`.

Vim jumps directly to line 42, column 18 — no marks to set, no searching required.

Tips

  • This works across scroll, search, and jump-list navigation — anything that moves the cursor without making a change leaves . untouched.
  • Use `. when you need to return after reading other code; use g; when you want to walk back through several recent edits.
  • The companion mark `^ returns you to where you last left insert mode, which can differ from . if you made a change and then moved the cursor before exiting.

Next

How do I programmatically set a register's content in Vimscript to pre-load a macro?