Vim Tips Wiki
Register
Advertisement
Tip 1637 Printable Monobook Previous Next

created 2009 · complexity basic · version 7.0


Here is how to synchronize your Vim configuration files over many computers (your Windows and Linux PCs, your MacBook, your office PC, etc.). Choose one of the following approaches and tools:

Dropbox[]

You can use a Dropbox account to synchronize your configuration files (vimrc or any files) to different computers.

Just move the config files into your ~/Dropbox/ directory (automatically created by installation of Dropbox software) and create new config files at the original location, containing:

source ~/Dropbox/<configfilename>

Now, each change of the config files inside your Dropbox folder will be synchronized to all other computers immediately.

Unison[]

The Unison File Synchronizer runs on and across Unix and Windows and is free (source code under GNU license). It detects changes on each system, and prompts for synchronization direction, offers merges, etc. Thus, you can edit your configuration on any system and reconcile any conflicts.

If you only have one master system where you make edits, and just want to push or pull updates to/from clients, the simpler rsync tool may be sufficient.

One helpful Vim setting in a mixed-OS environment is to use .vim for Vim user settings also for Windows systems (Vim automatically picks up a .vimrc config file instead of _vimrc by default). The following snippet in .vimrc will do the trick, and thus allow you to synchronize without directory renaming:

" On Windows, also use '.vim' instead of 'vimfiles'; this makes synchronization
" across (heterogeneous) systems easier.
if has('win32') || has('win64')
  set runtimepath=$HOME/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$HOME/.vim/after
endif

Version Control System[]

Some people have put (parts of) their home directory under version control, using a version control system like Subversion or Git. Many have also blogged about it, so search the web for instructions and reports. With such a setup, you get a (centralized or distributed, depending on the system being used) versioned history of your Vim configuration, and can use the commands of the version control system (like checkout and commit) to update it.

Comments[]

Amazing. Some brief info on what "synchronize" means would be good (is there are a master? is each machine a master? what if conflicts? what if a machine is off?). After setup, does the user have to take some specific action apart from modifying one of the specified files? JohnBot 03:38, October 25, 2009 (UTC)

Advertisement