A trick which will certainly power-up your Vim proficiency is to make use of jumps. 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
:jumps command. To move backwards through the jump list to an older jump use
ctrl-o. To move to a newer jump use
This short screencast that shows how efficient 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. 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
Vim will store up to 100 locations in your jump list. Realistically, you’re unlikely to use that many. But just a few taps of
ctrl-i can be an extremely efficient way to move between chunks of code or open buffers.
For more info, check out
:help jumplist in Vim.
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post?