Learn Vim / There and back again — vim

There and back again — vim

The answerCanonical keystrokes: /FIXME⏎ dd Ctrl-o dd.

Try it on a real buffer

From line 1, search down to the FIXME (/FIXME then Enter) and delete that line (dd). Now hop back to where you started with Ctrl-o and delete line 1 too.

delete me last, from up here
line of filler
another filler line
FIXME delete me first

Canonical solution: /FIXME⏎ dd Ctrl-o dd · par: 11 keystrokes (vimgolf rules — every keypress counts).

Why it works

Vim remembers everywhere you jump. Ctrl-o walks back through that jump list, Ctrl-i walks forward. A search counts as a jump — so Ctrl-o returns you to the pre-search spot instantly.

Reading about keystrokes doesn't build keystrokes. Try this in a real vim buffer right now — the “There and back again” mission takes about a minute.

Practice free — no signup →

Keep going