How do I view the list of positions I have jumped to in Vim?
Answer
:jumps
Explanation
How it works
Vim keeps a jump list that records your cursor position every time you make a jump. A jump is any motion that moves the cursor more than a line or to a different file, such as searching with /, jumping with G, or switching buffers. The :jumps command displays this list.
Each entry in the jump list shows:
- A number indicating its position relative to the current entry (negative numbers are older jumps, positive numbers are newer).
- The line number and column of the jump.
- The text at that line.
The entry marked with > is your current position in the jump list.
You navigate the jump list with Ctrl-O (jump backward to older positions) and Ctrl-I (jump forward to newer positions). The :jumps command helps you understand where those keystrokes will take you.
Example
After editing for a while, run :jumps and you might see:
jump line col file/text
4 102 5 def process_data():
3 45 12 import os
2 200 0 return result
1 78 8 for item in items:
> 0 150 3 print(item)
This tells you:
- Your current position is line 150.
- Pressing
Ctrl-Oonce will take you to line 78. - Pressing
Ctrl-Ofour times will take you back to line 102.
Tips
- The jump list can hold up to 100 entries per window.
- Each window has its own jump list.
- Use
:clearjumpsto reset the jump list for the current window. - Combine with
:changesto understand both navigation and edit history.