Tuesday, March 14, 2023

Re: How do I replicate vim settings across two machines?

On 2023-03-14, Enan Ajmain wrote:
> On Tue, 14 Mar 2023 14:09:47 +0000
> "'Ottavio Caruso' via vim_use" <vim_use@googlegroups.com> wrote:
> > Would it work if I sym-linked the remote .viminfo to the local one (or
> > vice versa)?
>
> First, you _have_ to do that. That's the way you share the info of
> which line you closed a file on, etc. The problem Christian was talking
> about was the difference in filenames of the same file. That question
> comes _after_ you have made a shared .viminfo file (either by symlinking
> or by using git).

You could instead have your vimrc test for the existence of
~/external/.viminfo (or any file or directory under ~/external when
mounted), and if it exists, set 'viminfofile' to
"~/external/.viminfo.

One solution to the problem of the file names being different would
be to pre-process the .viminfo file before it is read, replacing
$HOME/docs/mlog with $HOME/external/docs/mlog or vice versa,
depending on which laptop you are on, or perhaps on which file
exists. You could use a sed script with -i to do that, or use vim
to read, modify and write the .viminfo file. That would all be done
within your vimrc so that it is done automatically every time you
run vim. If the overhead of doing that is too great, you could, for
example, do that only when editing mlog.

Regards,
Gary

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20230314172011.GA13894%40phoenix.

No comments: