Is it possible to set global marks in a file not currently open?

vim

Solution

Yes you can. First, you need to assign a buffer number to the file (this does not load the file):

:badd somefile.txt

Then you can set the file mark via `setpos()`, which takes a buffer number

:call setpos("'Z", [bufnr('somefile.txt'), 45, 88, 0])

Problem

I want to be able to set global marks in another file, without having to open that file in a buffer. Something like this: ``` :set-global-mark Z, somefile.txt, 45, 88 ``` which would set mark Z to somefile.txt line 45 column 88. Is there an easy way to do this?

Original source