Monday, January 30, 2012

Re: set a mark in an arbitrary file

On 01/30/12 03:39, Samuel Ferencik wrote:
> Is there a way to set a mark to a file not loaded in a buffer, just
> specified by the filename?
>
> I keep losing my (uppercase) marks, and would like to set them up in
> my .vimrc. I'd do this using setpos(), but that requires a buffer
> number. I want to call something like setpos("'A", ['filename.c', 1,
> 1, 0]).

Not directly, but in your particular use-case you could create a
file named ~/.my_viminfo

that contains:
""""""""""""""""""""""""""""""""""""""""""""""""
# Value of 'encoding' when this file was written
*encoding=latin1

# File marks:
'P 1 0 ~/somefile.txt
'Q 21 10 ~/otherfile.txt
""""""""""""""""""""""""""""""""""""""""""""""""

adjusting/adding additional lines to specify where your
file-marks should be dropped. The encoding line is optional, but
helpful to have. If you have an existing .viminfo with the
file-marks you want (or have a session in which you've set the
marks you want, you can write one with ":wv"), you can just open
it and issue the following:

:v/^'/d
:saveas ~/.my_viminfo

Once you've saved those, you can then add the following line to
your vimrc:

rv ~/.my_viminfo

You can read the basics at

:help :rv

and far more than you probably want to know at

:help viminfo

-tim

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: