kvz.io
Published on

Sync Vim Config Across Workspaces

Authors
  • avatar
    Name
    Kevin van Zonneveld
    Twitter
    @kvz

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

I 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 https://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 https://www.dropbox.com/download/?plat=lnx.x86 -ko dropbox.tar.gz
$ tar -zxvf $_
$ .dropbox-dist/dropboxd &
$ popd

64bits

$ pushd /usr/src
$ curl https://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.

Legacy Comments (2)

These comments were imported from the previous blog system (Disqus).

Chiara
Chiara·

Dropbox is great. I do the same thing with my .bashrc file.

Eduardo
Eduardo·

You could use github too! You can creat a github (git) repo and clone it in every machine. Checkout github.com/mmacia/dotfiles or github.com/egulias/dotfils.

I'm learning VIM too!