dave yarwood
Reorganizing my vimrc


December 19, 2019


When I first started using Vim, I used “the ultimate vimrc” as the foundation of my Vim config. I had no idea where to start configuring Vim, and this looked like a good starting point for a nice, batteries-included Vim setup. It comes with a bunch of useful plugins installed and configured out of the box, a variety of sensible default settings, and some useful mappings.

There are a bunch of other, similar vimrc “starter packs” out there. spf13-vim is another popular one. I can’t really say that I would recommend one over the other at this point; I chose “the ultimate vimrc” somewhat arbitrarily, and if I were to do it all over again, I would go a different route entirely.

After having used Vim for years, my view on these starter Vim setups has changed. With the benefit of hindsight, I wish I had chosen to start with something more minimal, taken the time to understand what each setting did, and let my ideal setup grow from that organically. The more I’ve used Vim, customized it to my liking, and learned about its inner workings, the more I’ve had to contend with how my own custom settings and mappings interact with the base vimrc I started with and figure out which settings I need and which ones I don’t.

I recently decided that enough was enough, and I spent a few hours combing through all of the remaining settings left over from “the ultimate vimrc,” jettisoned a bunch that aren’t relevant to my setup, and promoted useful ones into my own custom setup. The result of this process is a smaller, more focused Vim config that I think is a lot easier to understand and maintain.

During this process, I also took the opportunity to organize related chunks of configuration into separate files in a single directory. The file names are all prefixed with numbers so that I can source them in alphabetical order; that way, it’s easy for me to understand in what order the settings are applied.

Here’s my ~/.vimrc in its entirety:

set shell=bash
set nocompatible

for f in split(glob('~/.vim/custom/*.vim'), '\n')
  exe 'source' f

The files in ~/.vim/custom/ are:

$ ls -1 ~/.vim/custom/

If you use Vim, you can probably guess what types of configuration you might find in each file. And if you don’t use Vim, then you probably wouldn’t find it all that interesting!

For the curious: my complete Vim configuration can be found here in my dotfiles.


Reply to this tweet with any comments, questions, etc.!