When doing :marks, there are a few marks that show up that I'm not quite sure what they do, even after reading the entry in the help section. For example, the following marks seem a bit obscure (at least in my understanding) to me:

  • '0-9 (shows a bunch of files for me)
  • '" (almost always shows the same thing as doing gg, is this always L1?)
  • '^ (how is this different than '. ?)

1 Answer 1


The marks 0-9 are the last 10 files you were editing. See :h viminfo-file-marks (took me a while to find the correct help subject).

  • '" : the cursor position when last exiting the current buffer (:h '"). Exiting here means closing the buffer (:bd) or exiting Vim while you edit a file. It does not mean leaving the buffer (like switching to another buffer). This mark is stored in the viminfo file (see :h viminfo). It can be used to restore the cursor position when you edit the file again (see :h restore-cursor).

  • '^ : the position where the cursor was the last time when Insert mode was stopped (:h '^)

  • '. : the position where the last change was made (:h '.).

If you insert some text, '^ and '. will point to the same location (nearly - '. is on the last inserted char, '^ after the last inserted char except for end-of-line).

If you do some change without inserting (e.g. delete a line) '. will reflect that position, while '^ is unchanged.

  • thanks for this. Could you please explain the cursor position when last exiting the current buffer a bit more ?
    – David542
    May 31, 2020 at 5:33
  • 1
    @David542 If you :bd a buffer and then :e that same file again, '" will take you to the line you were before you deleted it. If you have a viminfo file and save that mark there, that is typically used to restore the cursor to the last location whenever you open a file, so you're on the same context as when you last quit Vim on that file.
    – filbranden
    May 31, 2020 at 6:15
  • @David542 updated
    – Ralf
    May 31, 2020 at 6:22

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.