One day I finally decided it was time to make my Vim configuration a little more modular. What I ended up with was a .vimrc which contained only common, global Vim configurations, a list of plugins, and an incantation which pulls all other configuration from .vim/rc, a directory of files with plugin-specific configuration.
Here it is, stripped down bare:
- I use Vundle to organize my plugins and keep them up to date. I like Vundle for its ease of use, but there are many plugin managers for Vim so pick your favorite.
- There is no plugin-specific configuration in my .vimrc beyond the actual list of plugins. The only other configuration I leave here is either the bare essentials or common, global settings you'll see in most peoples' .vimrc.
- The last little bit sources per-plugin configurations or less-common configurations from ~/.vim/rc. This is probably the most important bit, as it makes everything neater and more modular.
On that last point, here's the list of files I have in my ~/.vim/rc directory:
Give it a shot yourself! I think you'll find keeping a maintainable .vimrc invaluable, especially when it comes to debugging your configuration or trying out new plugins and workflow tweaks.