← All lessons

14. Marks

Step 7 of 8

Special marks: visual selection

We’ve already met the gv command, which allows us to reselect our previous visual selection. When we use gv, how does Vim know where the last visual selection was?

The answer is that Vim sets the '< and '> registers to remember the last visual selection. This is useful to know — it means we can jump to the start of the last visual selection with '<, and the end with '>.

Give this a try in the editor. Make a visual selection, then re-enter normal mode. You can then use '< and '> to jump to the start and end of the visual selection you made.

Loading editor…