0

I followed the directions in this post to sync my vimrc file in Dropbox with my two Windows computers. However, I also want to move all the other user content of my vimfiles folder to Dropbox as suggested by jqno. I've read the documentation on Vim's initialization steps and environment variables, but can't figure out a way to direct it to my plugin folders, syntax files, color schemes, etc. in Dropbox.

This is my current vimrc:

let $MYVIMRC = "C:/Users/Norbert/Dropbox/vimfiles/vimrc"
set runtimepath^=$HOME/Dropbox/vimfiles
source $HOME\Dropbox\vimfiles\vimrc

If I copy all the contents of vimfiles to Dropbox and remove them from my $HOME directory, leaving only this minimal vimrc, none of my plugins load. If all the files are in their normal location, with only the full vimrc in Dropbox, everything works.

I've thought of two directions to go with this:

  1. Have only one vimfiles location with full content, located in Dropbox. Find some way to direct Vim to these files by either a relative or absolute path.
  2. Have a vimfiles location in Documents or another directory Dropbox can push to, so that each machine receives changes. However, I would still have to move the files on each machine and tell Vim where to look for them.

2 Answers 2

2

The way I do this is by having all the vim files located in my dropbox directory and then creating symlinks for the vimrc and vimfiles directory in my home directory. That way, vim isn't even aware that I'm doing anything "non-standard"; it just looks where it normally would and it finds the files as expected.

It's been a a few years since I've had to do this on Windows, but the mklink utility is what you should need to create the symlinks.

Edit: You can save a symlink by placing your vimrc in the vimfiles directory. Checkout :help vimrc for more info.

4
  • 1
    Can you keep your vimrc in vimfiles on windows? On nix I can have my vimrc be ~/.vim/vimrc, so it’s just one symlink
    – D. Ben Knoble
    Commented Dec 14, 2020 at 22:28
  • I can't believe I never bothered to look into this. It has always annoyed me that I've had to have two symlinks. According to :help vimrc it should work in Windows as well by placing the file at $HOME/vimfiles/vimrc.
    – Pak
    Commented Dec 15, 2020 at 15:00
  • I'll try this out, it seems like an easy solution. I can confirm that by default, the vimrc is in the vimfiles directory on Windows, so I'll only need one symlink. Does this method mean that the runtimepath does not need to be modified?
    – Norbert-op
    Commented Dec 15, 2020 at 23:35
  • I believe that is correct. You shouldn't need any special configuration to tell vim where to find stuff with this method.
    – Pak
    Commented Dec 16, 2020 at 3:59
0

Have you thought about setting up a Git repository with vimfiles?

Also, $MYVIMRC is a Enviorment Variable that you must set in you system, not on your vimrc, since Vim will go to that folder to locate the vimrc file.

1
  • Git is a steep learning curve for a non-programmer like me, so I'd like a Dropbox solution. I only set the $MYVIMRC for internal use in Vim, as the documentation suggested. I know it's not really necessary, but I wanted to save a step in getting to my full vimrc if I type it in the GVim command line.
    – Norbert-op
    Commented Dec 15, 2020 at 23:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.