Welcome to the Power Users community on Codidact!
Power Users is a Q&A site for questions about the usage of computer software and hardware. We are still a small site and would like to grow, so please consider joining our community. We are looking forward to your questions and answers; they are the building blocks of a repository of knowledge we are building together.
How to jump to original mark after overwriting
MWE
In Vim:
-
mm. o ESC-
mm(by accident, meantmn).
Question
How do I jump to the original mark m set in action 1.?
Edit
I'm sorry, what I meant was you issue mm when you meant 'm. (It almost happened to me again.) Both are legitimate.
1 answer
As far as I know, you can't. Each mark refers to a single location; if you change this location with the m command, the previous location is lost. There is no concept of a "mark value history" which can be accessed by the user.
Your best bet, if you want to avoid accidentally overwriting a mark, is to use a mark name which is hard to type accidentally on your keyboard. E.g. instead of using mm (which could happen easily due to key chatter or double-tapping), use mq or mz (assuming a QWERTY layout).

0 comment threads