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?
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])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With