Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Notifications
Mark all as read
Q&A

How to jump to original mark after overwriting

+3
−1

MWE

In Vim:

  1. mm.
  2. o ESC
  3. mm (by accident, meant mn).

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.

Why does this post require moderator attention?
You might want to add some details to your flag.
Why should this post be closed?

0 comment threads

1 answer

+4
−0

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).

Why does this post require moderator attention?
You might want to add some details to your flag.

1 comment thread

Ah, that's unfortunate. Yes `mm` was more of an example, but good suggestion considering. (1 comment)

Sign up to answer this question »