Step 2 of 8

14. Marks

User-defined marks

In the last section, I lied a little bit.

I said that we can set ‘a mark’ with mm. This is true, but we can also set a mark with ma. And mb. And mc!

You get the idea. Vim gives us a unique mark for every letter in the alphabet! This means that you can set as many marks as you’d like, for each different letter, and jump between them with 'a, 'b, etc.

I like to choose letters that have some meaning relevant to where they’re placed. For example, I often use the 'w mark to keep track of where I’m currently working. I also use the 'i mark to store the location of something I think might be interesting.

Work through the checklist below. The editor labels a home line for each of the marks a, b, and c — set all three with ma, mb, and mc, then bounce between them with 'a, 'b, and 'c.

  1. Set mark a on its labeled line Move to the line for mark a and press ma.
  2. Set mark b on its labeled line Same again further down — move to the line for mark b and press mb.
  3. Set mark c on its labeled line One more — move to the line for mark c and press mc.
  4. Jump back to mark a Straight back to the first labeled line — press 'a.
  5. Jump to mark b Down to the middle one — press 'b.
  6. Jump to mark c And the last one — press 'c.
Set mark a on its labeled line Move to the line for mark a and press ma.

Next: Set mark b on its labeled line

Loading editor…