How do I jump forward through the jump list after going back with Ctrl-O?
Answer
<C-i>
Explanation
Every time you make a "jump" — using G, /, %, :tag, <C-]>, or similar commands — Vim records your position in the jump list. <C-o> takes you backward through that list; <C-i> (or <Tab>) takes you forward again, restoring the position you were at before pressing <C-o>.
How it works
<C-o>— jump to the older (previous) position in the jump list<C-i>/<Tab>— jump to the newer (next) position in the jump list- Together they let you navigate backward and forward through your cursor history, like a browser's Back and Forward buttons
:jumpsdisplays the full jump list with relative line numbers and file names- The jump list holds up to 100 entries per window
Example
- You are editing
main.goat line 42 - You press
Gto jump to the end (line 200) — position saved - You use
<C-]>to follow a tag toutils.go— position saved again - Press
<C-o>— back to line 200 inmain.go - Press
<C-o>again — back to line 42 inmain.go - Press
<C-i>— forward to line 200 again
Tips
- In a terminal,
<Tab>may be captured by the terminal or tmux —<C-i>is more reliable - Not every cursor movement is a jump:
hjkl,w,b,edo NOT add to the jump list; large jumps (G,gg,/pattern,<C-d>) DO - Use
:clearjumpsto reset the jump list if it gets cluttered with noise from macros or scripts - The jump list is per-window — each split maintains its own history, so
<C-o>in a split does not interfere with another split's navigation