In my last post I explained that I was going to immerse myself in Vim for a month to see if I found it a suitable replacement for Sublime Text. Here’s what I learned in my first week:
Being an absolute Vim noob, I had to start at the beginning. I googled Vim and clicked through to vim.org. My first reaction was “oh, crap, this looks like an Apache project website.” Apache has some great projects, but those sites are all sterile, assume you’re an expert, and lack useful documentation. That’s what vim.org felt like. I mean, compare Sublime Text’s site with Vim’s. SublimeText’s site is all “Hey, look at this beautiful piece of software,” while Vim’s site is all “eep opp ork ah ah.”
I think that’s relevant. There was once a time in my life where I enjoyed tinkering with complicated software. I did several tours of running linux on old laptops. I built my own machines, recompiled binaries, and found crazy hacks to get things working the way I wanted them to. I’m past those days. I have a mac. I don’t want to tinker any more. I expect things to work. So, when I saw the Vim site, I got a little nervous. Was Vim going to make me more productive, or was it just going to earn me a nerd badge?
I clicked the “download” link on vim.org and was immediately faced with a decision: which mac client to use? I’ll make it easy for you, if you’re on a mac, use MacVim:
brew install macvim
With MacVim installed, I spent my first week familiarizing myself with the configuration options, plugins, and keyboard shortcuts. Here’s an overview of what I learned:
If you’re using MacVim and not using Janus (see the plugins section below), your configs will live in ~/.vimrc and ~/.gvimrc. The latter is used to store configs specific to the GUI version of Vim. The former is for general configurations.
One of the first configuration changes I made was to the color scheme. Hey, if you’re going to be staring at the same screen all day, it should be pretty, right? I’d been using the Monokai scheme for Sublime Text, so I was happy to find a version for Vim. I grabbed the Monaki.vim file and put it in ~/.vim/colors/ (create those directories if they don’t exist yet). Then I added the following config in ~/.vimrc:
colorscheme monokai. Note: after making changes to .vimrc and restarting MacVim enough times, I finally figured out how to reload changes without restarting. With .vimrc in the current buffer, do the following:
With my colorscheme set, I added some standard configs which I’d gathered from a variety of sample .vimrc files:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
It’s worth noting that most people use
set nowrap. I’d prefer that option, but when editing files with long lines, I found Vim to get super slow. The last thing I expected to have a problem with was Vim being slow. That alone would’ve been a show stopper. I googled a bit and found that one option was to turn off syntax highlighting. I tested that, and it worked, but I can’t live without syntax highlighting. The other option was to turn wrapping on, thus preventing long lines. Not ideal, but that resolved the problem for now. The
set spell config turned on spellchecker, which was nice while writing this blog post in Vim, but it too seemed to degrade performance, so I turned it off for now.
I’ve just started to play with customized key mappings, but I’ll hold off on discussing those until a later post.
There’s a large contingent of Vim users who recommend using the Janus to provide a basic foundation for the most common mappings. I played with Janus, and went back and forth on it several times. Ultimately, I decided against it. As a new user, I want to learn vanilla Vim. I want to experience the problems that Janus solves in order to understand why Janus exists.
Commands can be executed by single key presses (e.g.,
j to move down), control + key presses (e.g.,
Ctl + w + w to switch between splits), Cmd + key presses (e.g.,
Cmd + z to undo, and Leader + key presses. The “leader” is like adding an additional “Cmd” key to your keyboard. The default leader is
/, but it seems common to change that to the comma with the following configuration:
let mapleader = ‘,’
There are a ton of commands. Very few of them felt natural to me, and one week in, I’m still way slower than I want to be. I started my learning process by typing in
:help. Somewhere along the way, I found this cheatsheet, which has proven to be helpful on multiplate occasions. The absolutely best thing that I’ve done so far to learn the basic commands was to play Vim Adventures. If you’re serious about learning Vim, buy a license to this. I can’t recommend it enough.
Week one thoughts
I’m far from making a final decision, but with one week down, I’m not ready to declare Vim the winner. I do enjoy the key mappings, but I still can’t see a clear advantage over Sublime Text. Things that just work in Sublime Text, take a lot of tinkering in Vim. I was also REALLY surprised at some of the performance issues that I ran into with Vim. I never would’ve expected that.
Three weeks to go. Time will tell…