My vim configuration on Github
Ever since I started using Vim as my preferred text editor I have been keeping my configuration under source control. At first I kept my config for all the various applications + some useful scripts in one Git repository. But after I had given a (very) short presentation at work, I started to think about splitting of my vim-configuration into a separate repository. I have already learned a lot of useful tricks and settings about vim by studying other peoples vimrc-files, so I feel like it's only fair to also put mine out in the wild.
So first I did a little Git magic to split of my vim subdirectory into a separate Git repository, without losing any of the history. The answer on how to do this can be found on StackOverflow: Detach subdirectory into separate Git repository.
Then I created a repository on Github and pushed my entire vim configuration. Feel free to explore it and use pieces from it. (Or use it in it's entirety, but I don't think that would really be useful)
Some 'cool' features I use in my vimrc:
A few weeks ago I started using the Pathogen-script for vim. This script makes it possible to keep every vim-plugin in it's own directory. To use Pathogen you need to call at least one of it's functions so it can do it's job. I choose to keep this initialization in a separate file from my vimrc-file. That is why my vimrc starts with the following line:
The reason I use
runtime and not
source to 'source' the pathogen_init file, is because
runtime will search for the file in the vim runtimepath, while source takes an actual path. So by using
runtime I assure that the pathogen_init-script can also be found when running under windows (just in case I would ever have to use that again).
The actual pathogen_init script looks like:
" To disable a plugin, add it's bundle name to the following list let g:pathogen_disabled =  " for some reason the csscolor plugin is very slow when run on the terminal " but not in GVim, so disable it if no GUI is running if !has('gui_running') call add(g:pathogen_disabled, 'csscolor') endif " Gundo requires at least vim 7.3 if v:version < '703' || !has('python') call add(g:pathogen_disabled, 'gundo') endif call pathogen#runtime_append_all_bundles()
In this script I make use of the
g:pathogen_disabled variable, which is used by the Pathogen plugin. With it, you can conditionally disable plugins by adding it's bundle name to the
As I already described in an earlier blogpost, I use 'host-specific vimrc-files'. You can see this in the last lines of my vimrc. I simply check for the existence of a filename like 'vimrc-andoria' (when the hostname of your machine is 'andoria') and source it if it exists. (this code still uses
source so it will not work on windows).