How do I set a mark and jump back to it later?
Answer
m{a-z} then '{a-z}
Explanation
Vim marks let you bookmark positions in a file and jump back to them instantly. Lowercase marks are local to the current buffer, while uppercase marks work across files.
How it works
masets markaat the current cursor position'ajumps to the line of marka(first non-blank character)`ajumps to the exact position (line and column) of marka
Example
While editing a function on line 42:
- Press
mato set marka - Navigate elsewhere to line 200
- Press
'ato jump back to line 42
Tips
''jumps to the position before the last jump`.jumps to the position of the last change- Uppercase marks (
mAthroughmZ) persist across files :markslists all current marks