How do I delete all lowercase marks in the current buffer at once?
Answer
:delmarks!
Explanation
Marks accumulate as you work — ma, mb, mc and so on record positions for later jumps. Over time, especially in long editing sessions, the mark list fills with stale entries that clutter :marks output and can confuse navigation. :delmarks! clears all lowercase marks (a–z) in the current buffer in one command.
How it works
:delmarks {marks}removes specific marks by letter or range::delmarks ab,:delmarks a-f:delmarks!(with!) removes all lowercase marks (a–z) in the current buffer simultaneously- It does not affect uppercase (A–Z) global marks, special auto-marks (
'[,'],'^,'.), or numbered marks ('0–'9)
Example
Before:
:marks
mark line col text
a 5 0 function setup()
b 12 4 local config = {}
c 88 0 end
Run :delmarks!, then:
:marks
mark line col text
^ 12 4 (last insert position only)
All user-set lowercase marks are gone.
Tips
- To delete only a specific range:
:delmarks a-eremoves marks a through e - To also delete global uppercase marks:
:delmarks A-Z - To reset marks automatically when entering a buffer, add to your vimrc:
autocmd BufReadPost * delmarks! - Use
:marksto review all current marks before and after deleting - The
:delmarkscommand was introduced in Vim 7.0