Sync Vim Config Across Workspaces

1 minute read

As a Vim newbie, I'd like my Vim plugins & configuration to stay in sync between machines at home, office, my servers & a laptop.

If found that a (free) Dropbox account works like a charm.

First copy your best config to your Dropbox: logo.png

$ # In this setup, your config will be accessible by the world
$ mkdir -p  ~/Dropbox/Public/configs/vim
$ cp -raf ~/.vim  ~/Dropbox/Public/configs/vim/.vim
$ cp -raf ~/.vimrc  ~/Dropbox/Public/configs/vim/.vimrc

Next, on all machines, purge the currently installed vim config:

$ mv ~/.vim* /tmp/

.. and symlink the Dropbox's config in place:

$ ln -nfs ~/Dropbox/Public/configs/vim/.vim ~/.vim
$ ln -nfs ~/Dropbox/Public/configs/vim/.vimrc ~/.vimrc

Now when you change your Vim config anywhere, changes will be synced to all the workstations that you have set up this way.

Get Config on Untrusted Machines

Extra perk: because we use the Dropbox Public folder, you can even access your config on machines that aren't connected to your Dropbox by using wget:

$ curl http://dl.dropbox.com/u/XXXXXX/configs/vim/.vimrc -ko ~/.vimrc
  • Change XXXXXX with user id (or right click the config, copy public link)
  • Just the main config, no plugins (use a zip or web interface for that)

Trusted Servers (No GUI)

On trusted servers, you can even install Dropbox without a GUI :D

32bits

$ pushd /usr/src
$ curl http://www.dropbox.com/download/?plat=lnx.x86 -ko dropbox.tar.gz
$ tar -zxvf $_
$ .dropbox-dist/dropboxd &
$ popd

64bits

$ pushd /usr/src
$ curl http://www.dropbox.com/download/?plat=lnx.x86_64 -ko dropbox.tar.gz
$ tar -zxvf $_
$ .dropbox-dist/dropboxd &
$ popd

Then

Follow the instructions on screen.

The Dropbox folder is located at ~/Dropbox as usual.

To make sure Dropbox will load on startup run:

$ dropbox autostart

Afterwards symlink the config like you would normally.

Leave a Comment Right Here