DEV Community

Colin Bartlett
Colin Bartlett

Posted on • Originally published at vimtricks.substack.com

2

VimTrick: Using Jumps

Here's a super useful Vim trick that requires no plugins and which will certainly power-up your Vim proficiency.

In Vim, 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 ctrl-i.

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-o and ctrl-i. Similarly, the colon line number (:42) movement does not modify the jump list. Examples movements which modify the jump list are:

  • /pattern searches and ?pattern searches (forward and backward pattern matching)
  • * and # (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 gf

Over on VimTricks, we have a screencast and more details. Read the full tutorial.

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay