Vim Jump List
One trick which will certainly power-up your Vim proficiency is to make use of the Vim jump list. Jumps are cursor movements stored in a list called the jumplist. When making certain movements, such as jumping to line 42 with
42G, Vim will save it as a “jump” in the jumplist. You can list jumps using the
- To move backwards through the jump list to an older jump use
- To move to a newer jump use
<ctrl-i>. You can also press
Vim Jumplist Demo
This short screencast shows how efficiently you can move back and forth through a file with the jumplist:
Many shorter movements, like regular
hjkl and those based on motions do not modify the jumplist. So their movements will not be navigable with
<ctrl-i>. Similarly, the colon line number (
:42) movement does not modify the jump list. Use
<line number>G instead of
:<line number> to create a point in your jump history.
Examples movements which modify the jump list are:
?patternsearches (forward and backward pattern matching)
#(forward and backward search for the word under the cursor.
%(jump to a matching enclosing character like paren, brace, bracket, etc)
- Any inter-file navigation like
Keep in mind that the Vim jump list is a stack, similar to your browsing history. If you jump back several points and then create a new jump point in the middle of your history, then jump list points after that will be cleared. Your next jumps will continue building the stack.
Viewing and Clearing the Vim Jump List
You can view the jump list with the
:jumps command. Vim shows a jump number, the line and column number, and the file name or text of each jump in your history. The left column can be useful for jumping faster through your history. Note the number there is a number relative to your current position in the history. You can prepend that number before
<ctrl-i> to move more rapidly. As a demonstration, by pressing
3<ctrl-o> you can jump back to
thing.html from the jump list example below:
jump line col file/text 3 23 4 thing.html 2 1 0 some text 1 70 0 another line > 0 1154 23 end. 1 1167 0 foo bar
Vim will store up to 100 locations in your jump list. If you ever want to clear them all out, run the command
:clearjumps and your jumplist history will be wiped clean.
For more info, check out
:help jumplist in Vim. Also be sure to read about the Vim change list which is similar to but different from the Vim jump list.
How do I move through the Vim jump list?
ctrl-o to move backwards through the jump list in Vim. Press
ctrl-i to move forward to the next jump in the jumplist. You can also press
tab, as it will do the same thing: Move forward to the next jump in the history.
Where do I see the Vim jump list help docs?
For the full Vim jump list help docs, use the
:help jumplist command in Vim.
How is this different from the Vim change list?
The Vim jump list is a history of jumps you have made across files. The Vim change list is a similar history but of changes you've made. A change does not have to be made to add it to the Vim jumplist.
How can I see the Vim jump list?
To see the full list of changed, call
:jumps in Vim.
How do I clear the Vim jump list?
You can clear out the Vim jump list -- wipe your history -- by calling the
:clearjumps command at any point.
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post?