I use CTRL-O and CTRL-I heavily to move between previously visited positions. These commands rely on the jumplist.
It makes sense to me to visualize the jumplist as a stack of my position history. Thus, I'm surprised that the jumplist is effectively indexed by file and line number, which you can deduce from the vim docs.
In motion.txt
:
If the same line was already in the jump list, it is removed. The result is that when repeating CTRL-O you will get back to old positions only once.
It's a bit annoying to me because it doesn't preserve the exact history. Maybe I'm not conceptualizing the feature as intended. My questions:
- Is there a way to customize this behaviour?
- More importantly to me, what's the reason it was implemented this way?
Example
Take some file with >= 3 lines, do the following movement commands, and view the line numbers in the jumplist.
1G
2G
3G
2G
G "some movement to persist the last jump to the jumplist
Expected
1
2
3
2
Actual
1
3
2