Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

vim

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?

like image 510
fishyfriend Avatar asked Oct 14 '25 16:10

fishyfriend


1 Answers

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])
like image 185
Ingo Karkat Avatar answered Oct 17 '25 08:10

Ingo Karkat



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!