What is the scope of uppercase marks in vim? For example, this says:

Each file has a set of marks identified by lowercase letters (a-z). In addition there is a global set of marks identified by uppercase letters (A-Z) that identify a position within a particular file. For example, you may be editing ten files. Each file could have mark a, but only one file can have mark A.

For example, open your .vimrc, press mV, and close Vim. The next time you want to edit your .vimrc, just press 'V to open it.

I tried doing exactly this, setting a mark of 'V in my vimrc. I then closed the file, and opened up a new vim session with $ vim --clean and pressed 'V and I got the following warning:

E20: Mark not set

So, if the uppercase marks can't be used in different vim sessions, what's the usage of it?

1 Answer 1


The uppercase marks can be used when you opened multiple buffers in the same Vim session. If you use mark mV to mark the location of a specific function definition in a specific source file, then later start editing other files (through :e command or otherwise), you can then later use 'V to reopen the buffer with the source file that has the function definition you marked.

Marks (including uppercase marks) are saved to the viminfo file (assuming they're configured in the 'viminfo' option, the default is to save them), so you can use them across Vim sessions.

But if you start Vim with vim --clean, that prevents Vim to read the viminfo file in that session. So that's most probably why you're not getting access to your uppercase marks in that specific Vim session.

  • yea, from some trial-and-error it seems like it only works within the same session (which isn't too useful for me, at least). I checked out viminfo and made sure I had f1 set which stores the capital marks, but still I could only access them from a split window or another tab -- not another vim session. So is the viminfo file (re-)created for each vim session?
    – David542
    Commented Jun 14, 2020 at 23:15
  • 1
    actually, I got it to work, thanks for your help. It seems I had to close and re-open the vim session (not just resource the file) for this updated change to take effect.
    – David542
    Commented Jun 14, 2020 at 23:19
  • 1
    @David542 The viminfo file is saved when you quit Vim and read when you open it. If you have two Vim sessions opened at the same time, they won't share the marks...
    – filbranden
    Commented Jun 14, 2020 at 23:20

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.