What is a Jump?

Now that we have seen how the jump list is created and how to traverse it, there is one last topic: what is a jump? While it might seem obvious, the answer is not quite as clear as one might think.

Conceptually, one might expect the jump list to work like web browsing history, recording each location that we navigate to. This, combined with prioritizing recent jumps (as discussed in a previous section) would probably provide the most consistent and logical user experience. Unfortunately, jump list behavior is a bit more nuanced than that. For example, in the following example we jump down a few lines, then across to the end of a line:

Initial Conditions
1.·Line·1
2.·Line·2
3.·Line·3
4.·Line·4
5.·Line·5
 
6.·Line·6
7.·Line·7
8.·Line·8
NORMAL
Top
1:1
 
Jump down a few lines
4j
1.·Line·1
2.·Line·2
3.·Line·3
4.·Line·4
5.·Line·5
 
6.·Line·6
7.·Line·7
8.·Line·8
NORMAL
50%
5:1
 
Jump to the end of the line
$
1.·Line·1
2.·Line·2
3.·Line·3
4.·Line·4
5.·Line·5
 
6.·Line·6
7.·Line·7
8.·Line·8
NORMAL
50%
5:9
 
Check the Jump List
1.·Line·1
2.·Line·2
3.·Line·3
4.·Line·4
5.·Line·5 
 
6.·Line·6
7.·Line·7
8.·Line·8
NORMAL
50%
5:9
 
:jumps
 jump line  col file/text
>

Although we jumped to locations in the buffer, the jump list in step 3 did not record any of these movements. What happened? The types of movements we made in in the previous example are "close-range" jumps, which are very common when editing documents. The convenience of using the jump list in these situations is outweighed by the sheer volume of entries that this would add to the jump list, making it less efficient in the situations where it is needed.

The decisions about which commands update the jump list and which don't seems to have been somewhat arbitrary, but here is a list of those that do:

Marks

Jumping to a mark updates the jump list, providing a second option for accessing marks that are returned to often. As a quick refresher, here are the basic operations for jumping to a mark:

CommandAction
'xJump to the start of the line containing mark x
`xJump to mark x

We should point out that there are variants of each of the preceding operations that allow you to jump to marks without affecting the jump list: simply precede each operation with a g (for example, g`x) These can be handy and keep your jump list clean when writing macros or other situations where marks might be used as placeholders, rather than actual jump locations.

"Window" Motions

Although line-related vertical motions such as j do not update the jump list, "window" motions that move the cursor relative to the window do. For example, these all update the jump list:

CommandAction
[n] Hcursor to line N from top of screen
Mcursor to middle line of screen
[n] Lcursor to line N from bottom of screen

Which are roughly equivalent to these, which update the jump list as well:

CommandAction
[n] ggcursor to line N, default first line
[n] Gcursor to line N, default last line

Finally, if your cursor is located in a filename you can jump to if using gF, which will also update the jump list.

Searching

Searching can be an effectively way to quickly move the cursor a long distance within a document, so these operations update the jump list. Searching can be forward or backwards, and locations visited while repeating the searching using n and N do as well.

CommandAction
/{pattern}search forward for the Nth occurrence of {pattern}
?{pattern}search backward for the Nth previous occurrence of {pattern}
[n] nrepeat the latest '/' or '?' N times
[n] Nrepeat the latest '/' or '?' N times in opposite direction

Text Objects

motions over text objects are also recorded in the jump list:

CommandAction
[n] (cursor N sentences backward
[n] )cursor N sentences forward
[n] [[cursor N sections backward
[n] ]]cursor N sections forward
[n] {cursor N paragraphs backward
[n] }cursor N paragraphs forward