The jumplist
From looking at the changelist, we now understand the basic concept we’re working with here. Vim is keeping track of a list of locations, and there are maps to move back and forth between them.
The changelist is very useful, but most of the time we’re reading documents rather than editing them. For example: programmers often need to jump around various files, following a sequence of function calls, to understand how the code is working. In situations like these, we’re not editing anything, so the changelist isn’t applicable.
Thankfully, Vim has another useful list called the jumplist. The jumplist is all about jumps, which are anything that moves your cursor a “significant distance”. For example, moving one line upward with k isn’t a jump, but moving ten lines up with 10k is. The jumplist keeps track of the positions you were in before you made a jump, giving us an easy way to return to where we were before.
To use the jumplist, it’s <C-o> to jump one position back and <C-i> to jump one position forward.
Let’s give it a go. This time, use 10G, 20G, and 30G to jump to lines 10, 20, and 30 respectively. Once you’ve done that, experiment with <C-o> and <C-i> to jump back and forward in the jumplist.