Taming your Vim config - Vim tip 3 of 3

On a weekly basis I switch between 6 different setups and I alter in my .vimrc quite often. I would lose a lot of time if I manually managed my configuration. In this tip I will tell you how to:
  • Build up a feasible Vim configuration structure so your vimrc, plugins, syntax files, ... are all manageable.
  • Putting your whole configuration in a version control system.
  • How you can access my (amazing) Vim configuration.

Notice: When I write ~/ it means C:Documents and SettingsYourUser on Windows.

Building a configuration structure

I hope you know what a vimrc file is, if you don't read about it here.

My current vimrc looks like this:

fun! MySys()
  return "windows"

set runtimepath=~/vim_local,$VIMRUNTIME
source ~/vim_local/vimrc

What, 4 lines? Jea, it's only initialization file that sets following:

  • MySys: What O/S are we on?
  • runtimepath: Source colors, plugins, doc etc.!
  • source: Source the main vimrc (i.e. the one that actually has a lot of configuration)

Why is this smart? Because you can then share the same vimrc on all platforms, i.e. when updating your vimrc you don't have to set that you're on window, unix or mac.


Runtimepath is really smart. Basically if you put ~/vim_local in your runtimepath Vim will search and source under following directories:

  • ~/vim_local/plugin/ - All your plugins
  • ~/vim_local/colors/ - All your color schemes
  • ~/vim_local/doc/ - All your docs
  • etc...

Version control system

Use a version control system, if you use Vim on different computers. It saves a lot of time.

I am using SVN to manage my ~/vim_local/ directory. Basically, if I add a new plugin I do following:

  • svn add ~/vim_local/plugin/foo.vim
  • svn commit -m ""

Then on all my setups I can do:

  • svn update

And bam, I get that plugin. The same goes if I add some new clever mapping in my vimrc. The other approach would be to manually edit in all 6 configurations (I have tried this, believe me, you will have 6 different Vim configurations :-D)

My KICK ASS Vim configuration

The features:

  • 800 line commented vimrc
  • Beautiful color schemes
  • Useful plugins
  • Works on Mac OS X, Linux and Windows
  • Around 2 years of work
  • A lot of goodies
  • Works with Vim 6.3 and Vim 7

Color schemes included:

Plugins included:

Please, click on the links to read about what the plugins do.

How to get it?

First check out to ~/vim_local:

mkdir ~/vim_local
svn co svn://orangoo.com/vim ~/vim_local

Next update your vimrc:

map ½ $
imap ½ $
vmap ½ $
cmap ½ $

"Can be: linux, mac, windows
fun! MySys()
  return "unix"

set runtimepath=~/vim_local,$VIMRUNTIME
source ~/vim_local/vimrc

½ is the key bellow ESC (at least on my danish keyboard). It's pretty crucial that you map this key to $. I use it often in my mappings.

Read it online

I have updated my vimrc and you can read it online:

12. Aug 2006 VIM Editor
© Amir Salihefendic