Marks
Marks in Vim are kind of like bookmarks. They are used to tag a location in your document that you might want to return to later.
Vim has two types of marks: marks that are manually set by you, and marks that are automatically set by the editor. Both types are useful in different situations.
As an example of where you might use marks, consider the following situation: you’re trawling through a codebase hunting for a bug, and you’ve just spotted a function that warrants some further analysis. But before you start debugging that function, there’s a few other places you’d like to look first — perhaps further down the call stack, or elsewhere in the current buffer.
In this kind of situation, it would be a good idea to set a mark on the interesting function so that you can easily return to it. Setting a mark means that returning to the interesting function is just two keystrokes! That’s much easier than finding it again by scratch, or grepping for it.
So, how do we set a mark? For now, we’re going to consider just two keymaps:
mmsets the mark'mjumps us back to the line where the mark is set
Let’s try this in the editor. Place a mark on the line where the interesting function starts with mm, then jump to the bottom of the buffer with G. Then, try jumping back to the interesting function with 'm.