How do I jump back several entries in the jumplist with a single command?
Answer
5<C-o>
Explanation
Most Vim users know <C-o> jumps backward in the jumplist, but fewer use a count with it. Prefixing <C-o> with a number lets you move multiple jump locations in one shot, which is useful after deep tag jumps, search hops, or LSP definition chains where stepping back one location at a time is slow.
How it works
5<C-o>
5is the count<C-o>moves backward one entry in the jumplist- Combined, Vim moves backward up to five entries at once
If fewer than five older entries exist, Vim stops at the oldest available location. To move forward again through the list, use the opposite direction command with a count.
Example
Suppose you navigated through these positions while inspecting code:
main.go:120 -> router.go:45 -> handlers.go:88 -> db.go:12 -> config.go:30
From config.go:30, pressing <C-o> repeatedly returns one step at a time. Pressing 5<C-o> jumps back through the chain immediately to the earliest recorded spot in that sequence.
Tips
- Use
:jumpsto inspect the current jumplist - Pair with
3<C-i>to move forward three entries when you overshoot - Counts work with many motions; using them with jumplist commands is a high-leverage navigation habit