vimtricks.wiki Concise Vim tricks, one at a time.

How do I jump back to the previous context line without preserving exact column?

Answer

''

Explanation

When you jump around a file, Vim tracks prior locations. Most people use exact-position jumps, but '' is often faster when you care about line context more than exact column. It returns to the previous location's line and lands at the first non-blank character, which is ideal for review and structural editing.

How it works

  • '' jumps to the line of the previous context mark
  • It uses linewise behavior, so Vim lands on the first non-blank character
  • This differs from ```` (backtick-backtick), which restores the exact prior column
  • It is useful after big motions (/, %, G, tag jumps) where column fidelity is unnecessary

Example

You are editing near one function and jump far away to inspect another area:

line 42: if err != nil {
line 43:     return err
...
line 410: cleanup()

Run:

''

Vim returns to your earlier context line, aligned to indentation, so you can continue quickly without extra horizontal cursor fixes.

Tips

  • Use ```` when exact column restoration matters
  • Use '' when line-level context is enough
  • Pair with <C-o> and <C-i> when traversing deeper jump history

Next

How do I save only real file buffers when running bufdo across many open buffers?