0

I'm at home on a few unixy systems, FreeBSD/amd64, Linux/amd64 and Solaris/Sparc. I would like my ~/.vim directory as portable as possible, ideally in such a way I can keep them identical (say, rsync them after modifying my reference installation).

How portable is a vim configuration with installed plugins?

I can think of a few possible issues getting in the way of full portability (defined as copy all files from your reference and everything just works). Assume major and minor versions of vim are the same.

  • Do plugins install files outside of ~/.vim, say /usr/local or /opt?
  • Endianness: amd64 is LE, while SparcV9 is BE
  • Absolute paths recorded at installation time
  • Availability of and PATH to third party tools (python 3, ...)
  • termcap vs. terminfo
  • Anything else I have missed

Before I just do it, is copying everything a dumb idea waiting to fail? Anything else I should watch out for? I'm happy to have some code in my .vimrc conditional on the OS or host I'm on.

Note: I know .vimrc is pretty portable. That's no what I'm asking. I am specifically interested in the portability of the whole .vim directory, where plugins are installed and configured.

Jens
  • 363
  • 3
  • 13
  • 1
    If you put a vimrc file in github repo, you can clone that on any machine and then create a link to it: ln -s path/to/repo/repo_vimrc ~/.vimrc. See here and here for examples. – mattb Feb 20 '22 at 17:39
  • For reference we had several other questions on the same topic. Sharing your dotfiles and especially your .vim directory is a very common practice and there are several approaches so I think this question is too vague. – statox Feb 21 '22 at 14:22
  • But basically everything is supposed to be in you .vim directory, simply clone it but don't include the plugins (instead use :PlugInstall of the equivalent for your plugin manager when you clone your dotfiles). You can also add some tests with :h has(), :h filereadable() and this kind of helpers commands to customize your vimrc according to the machine you are setting it up on. – statox Feb 21 '22 at 14:24
  • @statox The plugin issue is exactly an item I am worried about. How do I exclude those from copying? So a simple clone of .vim is apparently not a good idea. – Jens Feb 21 '22 at 14:31
  • @statox The other answers you refer to talk about .vimrc, but I am interested in the portability of what's in the .vim tree (also in the question title). This is why I asked a new question. It appears this is not yet addressed in any of the other questions. – Jens Feb 21 '22 at 14:34
  • @mattb But a .vimrc is not the same as the contents of the .vim directory tree. Can that be cloned without surprises when it has plugins installed? Or do I need to install plugins on each system, as @statox appears to recommend? – Jens Feb 21 '22 at 14:41
  • I don't know the answer to your question - I install the plugins on each system. I also have set backupdir=path/to/dotfile/repo/back_up// and set directory=path/to/dotfile/repo/swap// and set undodir=path/to/dotfile/repo/undo// to keep those things synced too. – mattb Feb 21 '22 at 14:59
  • Not copying your plugin directory is mostly to avoid having handling git submodules in your dotfiles repository. But plugins are just self contained vimscript code. When you clone them again in a new machine you are not doing much more than simply copying the directories. When you say .vim and .vimrc are not the same, since vim 7.4 the .vimrc is expected to be in the .vim directory. So it's still very related. What I do is that I simply version my .vim directory and add vim/plugged and vim/viminfo to the .gitignore and I never had any issue – statox Feb 21 '22 at 15:59

0 Answers0