A .vimrc for Beginners

I love vim. I use it for code, notes and blogging (meaning I’m using it right now). It is a great tool with a tonne of smart, powerful features that I have barely started to get my head around. There was a time when my vimrc file was hundreds of lines long filled with all the cool bindings and snippets I found online. Truth is though, I never used any of them.

I know what they did but the sheer number of them made it hard to remember and made me frustrated with vim. I knew vim was good and I knew the features were enabled so it must be me thats doing something wrong. So I stopped using it. I got fed up and put it away for another day. When that day finally came I was on a new laptop without my old vimrc. Probably in the best place I could have been. A fresh start.

I found the situation a lot like teaching my mum how to send emails. At first I would bombard her with keyboard shortcuts and tricks to save her seconds here and there. In the end I would find myself showing here again and again because I was trying to introduce far too much at once when all she really wanted to do was send an email. Once I noticed this it became much easier to show her new things. I would pick the trick or shortcut that would have the biggest effect and showed it to her. For example cut and paste went down a treat when it wasn’t paired with archiving emails, reply all and how to organise an inbox. Anyway, back to vim.

This time was different. I enabled the bare minimum like syntax highlighting and disabled the arrow keys. From there I committed to really learning what vim was all about. I had a post on my old blog about a post by Yan Pritzker (here) which I still maintain is the tipping point for my understanding of vim. I really started to ‘get’ vim and most importantly some of the design ideas behind it.

The more I understood the less I needed. I turned on some indenting features for code, a colour scheme and search highlighting but that was it. Sure there are some useful add ons and sure they may increase productivity by 100% but the question I ask is whoes? At this point the gains of adding all the extra modifiers would probably be minimal. My current approach is to just write, when I find myself doing something multiple times I stop and check if there is a better way do to it. Usually there is, without needing to add a new plugin.

So that’s my recommendation, Start with an empty .vimrc and only add things as you find yourself needing them. As always your milage may vary but for me this has worked wonders. For anyone interested here is my .vimrc:

" filetypes
filetype plugin on
filetype indent on

set hlsearch

set showmatch

syntax enable

colorscheme desert
set background=dark

set expandtab
set smarttab
set shiftwidth=4
set tabstop=4

- Elliot