0

So I decided to take the plunge into learning vim and moving over from sublime as my main editor.

I have a few different machines running different OSes. OSX on my laptop, Linux on my primary machine at home, and Windows on my machine at work. When using sublime, I could store settings and config in dropbox and have each machine pull the settings down on each machine. Any changes that get made essentially get pushed to all machines.

I'd like to achieve the same thing with vim. Get a single config running on dropbox, and have each machine use the settings stored in the cloud.

I'm wondering if there are any modern guides on how to achieve this? After some googling, I found some old guides but I understand that the way vim handles vimrc files on windows is different in the latest version? Furthermore, I see that linux (and maybe osx) use .vimrc whereas windows has a _vimrc file?

Still very new to vim at the moment so I don't understand the differences between these file types. Are there any simple guides that will show me how to get everything set up across the different ecosystems?

I'd be OK using either dropbox or github for this. Although most likely I will use both and create a folder on dropbox and push that folder up to github as well for version control.

1

I use Github to sync my vimrc across computers, symlinked from my dotfiles repo folder to ~/.vimrc. It's not fully automatic, since I still need to install some Vim plugin dependencies on a brand new machine, but it's helpful enough for me to keep the basic settings in sync.

I don't use Vim on Windows, so I can't speak to how differently vimrc is handled there. If it's only the filename that's different, maybe you could link or alias your file to C:\whatever\_vimrc.

If you need OS-specific settings, it is possible to check the current OS from within the vimrc file, as described in this answer's example:

if has("win32")
  "Windows options here
else
  if has("unix")
    let s:uname = system("uname")
    if s:uname == "Darwin\n"
      "Mac options here
    endif
  endif
endif

As far as a guide for doing this, you might find something useful in this "unofficial guide to dotfiles on Github": GitHub ❤ ~/, which is not Vim-specific but has lots of dotfile-management examples. You could also search "vimrc" or "vimrc windows" on Github for reference and inspiration.

Have fun with vim!

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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