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

How do I jump to the start or end of the last visual selection?

Answer

`< and `>

Explanation

The `< and `> marks automatically track the boundaries of the last visual selection. Jumping to these marks lets you revisit or reselect the same text.

How it works

  • `< jumps to the start (first character) of the last visual selection
  • `> jumps to the end (last character) of the last visual selection
  • These marks are set automatically whenever you make a visual selection

Example

You visually select lines 10-20 and yank them. Later, pressing `< returns to line 10 and `> returns to line 20.

Tips

  • gv reselects the exact same visual selection
  • '< and '> jump to the lines (first non-blank) instead of exact positions
  • These marks are used in :'<,'> range specifications
  • `[ and `] track the last changed/yanked text instead

Next

How do you yank a single word into a named register?