I pressed me instead of 'e and the mark "e" got overwritten with the current position, instead of jumping to it. How do I undo it?
- 17,755
2 Answers
:delmarks e will delete a specific mark. It can be abbreviated :delm e
From the wiki:
Command Description
:delmarks a delete mark a
:delmarks a-d delete marks a, b, c, d
:delmarks abxy delete marks a, b, x, y
:delmarks aA delete marks a, A
:delmarks! delete all lowercase marks for the current buffer (a-z)
To address your comment:
In order to save a history of your marks, you need to write a viminfo file using :wv[iminfo][!] [file].
The viminfo file is used to store:
- The command line history.
- The search string history.
- The input-line history.
- Contents of non-empty registers.
- Marks for several files.
- File marks, pointing to locations in files.
- Last search/substitute pattern (for 'n' and '&').
- The buffer list.
- Global variables.
This can be read back with :rv[iminfo][!] [file].
There is a big caveat to using an viminfo file to store your marks. It will only store uppercase or numerical marks. Not lowercase marks.
Lowercase marks 'a to 'z are remembered as long as the file remains in the buffer list. If you remove the file from the buffer list, all its marks are lost. If you delete a line that contains a mark, that mark is erased.
- 924
Once you have "overwritten" a mark with a new location it cannot be undone. The best you can do is possibly press ctrl-o until your cursor is at the old location and create the mark again.
- 20,411