2

From the vim manual:

m'  or  m`      Set the previous context mark.  This can be jumped to
            with the "''" or "``" command (does not move the
            cursor, this is not a motion command).

I could not understand what this does or what its used for, tried to "set" previous mark to another mark using that, but it did not work.

1 Answer 1

1

The ' and ` are synonymous. It correspond to position before the last move (with the exception of the very small moves. e.g. one character, one line)

The m' (and its sister: m`):

  • Set the last position mark explicitly
  • Add an entry at the top of jump list
  • Move the jump list cursor to the to of the it

I believe this command is used by plugin developers when they create moves.

It let them:

  • Mark the original position before the jump
  • Maintain the jump list

This to make the jump commands works like expected:

  • Ctrlo
  • Ctrli
  • ''
  • `'
1
  • Thanks! This can be verified by visiting the jump list (:jumps). j or k are not jumps while the mentioned m`, or m' somewhere would create a jump record.
    – pigeon
    Commented Sep 12, 2022 at 10:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.