How do I cycle through all lowercase marks in the current file sequentially?
Answer
]'
Explanation
The ]' command jumps to the start of the line containing the next lowercase mark in the file, while [' jumps to the previous one. This lets you traverse all marks in order without remembering which letter you set — useful when you've placed several marks with ma, mb, mc etc. and want to step through them.
How it works
]'— jump to the next line containing a lowercase mark (cursor lands on the first non-blank character)['— jump to the previous line containing a lowercase mark]`— like]'but jumps to the exact line and column of the mark[`— like['but jumps to the exact line and column
These motions wrap: after the last mark in the file, ]' circles back to the first.
Example
Suppose you have marks ma on line 5, mb on line 20, and mc on line 40:
Line 1
...
Line 5 ← mark a
...
Line 20 ← mark b
...
Line 40 ← mark c
With cursor anywhere before line 5, pressing ]' jumps to line 5. Press ]' again to reach line 20, then line 40. This avoids having to type 'a, 'b, 'c explicitly.
Tips
- View all marks with
:marks - The backtick variants (
]`/[`) preserve column position — useful for marks set in the middle of a line - These motions also count as jumps, so you can return with
<C-o> - Works only for lowercase (file-local) marks
a-z, not uppercase (global) marks