Vim Marks and Jumps — m, ', `, and the Jump List

Bookmark positions in files with Vim marks. Learn local marks (a-z), global marks (A-Z), automatic marks, the jump list, and the change list for efficient navigation.

Marks

Detailed Explanation

Setting and Using Marks

Marks let you bookmark positions and jump back to them instantly:

Setting Marks

Command Action
m{a-z} Set local mark (within current file)
m{A-Z} Set global mark (across files)

Jumping to Marks

Command Action
'{mark} Jump to the line of the mark (first non-blank)
\{mark}` Jump to the exact position of the mark
:marks List all marks
:delmarks {marks} Delete specified marks
:delmarks! Delete all lowercase marks

Automatic Marks

Vim sets several marks automatically:

Mark Position
'' or \`` Position before the last jump
'. or \.` Position of the last change
'^ or \^` Position where Insert mode was last exited
'[ or \[` Start of the last changed or yanked text
'] or \]` End of the last changed or yanked text
'< Start of last visual selection
'> End of last visual selection

The Jump List

Every time you make a "jump" (search, mark, gg, G, etc.), Vim records your position:

Command Action
Ctrl+o Go to previous position in jump list
Ctrl+i Go to next position in jump list
:jumps Show the jump list

The Change List

Vim also tracks where you made changes:

Command Action
g; Go to previous change position
g, Go to next change position
:changes Show the change list

Workflow Example

  1. You are at line 100, editing a function
  2. You need to check something at line 10: ma (set mark a), then 10G
  3. After checking: \a` to jump back to exactly where you were

Use Case

You are navigating a large file and need to bookmark important positions, jump between them, or use the jump/change lists to retrace your editing path.

Try It — Vim Cheat Sheet

Open full tool