Kevin van Zonneveld

On Development and Internet System Engineering

Sync Vim Config Across Workspaces

| Comments

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

1
2
3
4
# 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:

1
mv ~/.vim* /tmp/

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

1
2
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:

1
2
3
wget -O- http://dl.dropbox.com/u/XXXXXX/configs/vim/.vimrc > ~/.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

1
2
3
4
cd /usr/src
wget -O dropbox.tar.gz http://www.dropbox.com/download/?plat=lnx.x86
tar -zxof dropbox.tar.gz
.dropbox-dist/dropboxd &

64bits

1
2
3
4
cd /usr/src
wget -O dropbox.tar.gz http://www.dropbox.com/download/?plat=lnx.x86_64
tar -zxof dropbox.tar.gz
.dropbox-dist/dropboxd &

Then

Follow the instructions on screen.

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

To make sure Dropbox will load on startup run:

1
dropbox autostart

Afterwards symlink the config like you would normally.

Imported comments

These were imported from my old blog. Please use disqus below for new comments

Eduardo on 2011-08-17 13:56:31
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!

Chiara on 2010-12-04 19:41:56
Dropbox is great. I do the same thing with my .bashrc file.

Comments