I’ve known the basics of Vim for quite a while. You can’t work in the world of Unix-like systems without running into it. Although there are more friendly editors like pico and nano, Vi/Vim is almost guaranteed to be available so it has always been worth knowing the basics. At the very least you have to know :q!.

Due to my frequent switching season fever, I’ve taken stabs at making Vim a more daily part of my work life. Each time I try I’d say I’m driven by three things equally: a desire to perform complex text tasks quicker; a desire to use a stable text editor that won’t be abandoned or dramatically change from one year to the next; and, of course, a desire to tinker and yak shave. I find yak shaving extremely beneficial for myself. It’s like recess for my brain.

So after quite a few years of attempting to switch to Vim, I finally managed in 2013 to switch almost entirely. I still find myself opening SublimeText for high-level code browsing, but day-to-day it is full-screen Vim with horizontal splits and iTerm tabs for me.

Here is how I did it:

  1. I changed my bash shell to vi mode. I knew that default bash shell was Emacs mode and so cursor motion like C-a and C-e are burned into my brain even though I haven’t used Emacs in over 10 years. You don’t get all the nice bits of Vim like ciw, but you do get a lot of the cursor movement that you need to know to be good with Vim. To turn it on run: “set -o vi” at the command-line to test it out and put that command in your .bash_profile to use it for every session. You can also edit your .inputrc to use Vi mode everywhere GNU Readline is used (like the command-line MySQL client), but I haven’t tried that yet. You can read more about Vi mode here and here.
  2. I started with a blank .vimrc. You see a lot of people sharing their .vimrc files and they are usually these sprawling, multi-page settings files that are almost incomprehensible. There is always good stuff in there but if you don’t know why they’re doing things and just copy one completely you’re going to have a bad time. I know I did. Every time I quit trying to use Vim it was because there was stuff getting in the way of what I wanted to do. When you start from plain, vanilla Vim you are forced to figure out exactly what you want to do, Google it, and then learn how you can alter your settings file to achieve what you want. Plain, vanilla Vim is perfectly fine for editing. I see my .vimrc as a way to just make it a bit comfortable to me.
  3. Ignore Pathogen and Nerdtree and Janus and just use Vim. Like what I said above, to learn Vim I had to learn Vim. Not Vim with fancy file browser trees or massive add-ons that made Vim more like TextMate.

The nice thing about learning something that has existed for over 20 years is that anything I’ve wanted to do has already been explained and written about many times. This is how I did it, and if you have always wanted to try or have been discouraged in the past due to the same mistakes I made, I think you should try it again.