Guess what I wrote this article in?
— 6 min read

VIM: 8 Takeaways From One Year Of Typing

While overhyped, VIM is a powerful tool that once learned, you'll never leave behind.

“OMG You have to try Vim.” - lots of people

So around a year ago after about 8 years of using numerous OSX / Windows based text editors and IDEs, I decided to switch to VIM. Why?

Mostly I was bored with Sublime, and in 2014 and LightTable weren’t that impressive, so I figured why not try something new.

It’s been a year and I’m stuck on VIM. While I occasionally default to Sublime for some tasks (project wide find and replace, namely), VIM is my main text editor and it looks to stay that way.

Here are some takeaways from one year of using Vim.

VIM is like The Wire - you need to stick with it.

For every fellow fanatic of The Wire, I’ve met a person who says something like

“Well, I watched an episode or two, but just couldn’t stay with it.” - lots of people

Their loss. VIM is just like The Wire in that aspect. It’s a slow battle at first to gather your bearings and get to be as efficient as you were with your old editor. This slow battle may in fact involve you using two editors at first to get over the rough patches.

But stick with it! Just like The Wire, the payoffs with VIM take place after you’ve learned the basics and can start stacking and linking things together. In the show, the “I get it now” moments come deeper than the first few episodes. VIM’s best moments may be weeks or months into it.

VIM is just a text editor. Get over it.

This seems somewhat obligatory, but VIM is absolutely, 100%, definitively over hyped as a text editor. In truth there are lot of options out there, and in truth none of them matter. None of them will make you smarter, or better at writing code, or any of that. Hate to be a buzz kill but don’t go into using VIM with high expectations.

VIM isn’t just a text editor - it’s a multi purpose tool.

If the previous point were the only truth, I wouldn’t still be using VIM to type this article would I? VIM is a text editor at heart, but it’s approach is radically different.

Most text editors are big knives, you point to where you want to type and start typing away. VIM is a swiss army knife, where you evaluate the text you want to edit mentally, and then use VIM commands to edit it as efficiently as you know.

Being intergrated into your terminal / command line interace is another key advantage as you don’t have to swap between the two as much during your work day.

VIM commands aren’t just a pile of keyboard shortcuts - they’re an entire language.

Since all commands in VIM are keyboard driven, there is often useful overlap and interchange between them. So the first thing you learn is to delete a word: dw. Then to delete til the end of the line: d$. Then the entire line: dd.

So what’s next? Copying is y - yank. Just replace d in the above examples with y, and the rules still apply, but will copy instead of delete the line. And believe me - it gets deeper than just 2 letter commands. Delete the bottom 4 lines? d[downkey]4. 3 letter commands!

All commands are to some extend variable and interlocking, yielding more dynamicism than a normal text editor can provide. The exciting part about this is that you can always be learning how to VIM for years to come.

VIM will make every keypress deliberate - and that’s a good thing.

Comparing experiences, one of the interesting things I found out was that often times in editors like Sublime, I would mindlessly begin coding a solution, then editing the resulting litany of typos and invalid method calls until the thing compiled. I just wouldn’t think about it because editing code was simplistic with a mouse.

With VIM, I know I’ll have to take a (ever depreciating) moment to consider how to move around and articulate myself in the file I’m in, and that’s a great thing as a coder. I spend a lot more time thinking with greater articulation about what it is I’m about to write, which results in less errors and better code.

VIM is super portable.

Setting up your preferred text editor can be a hassle when starting a new gig on a new machine. Lucky for you VIM is supported in all major OS’s and is a breeze to setup via a .vimrc file. When you customize VIM you have to edit and mantain your personal .vimrc file, and this enforces portability of your VIM environment.

As web developers we’re often asked to SSH into production boxes at precarious times - pre launch, big client meeting, et al. Those situations used to scare me because I had to use VIM - what if I made a mistake in production? - now I don’t have that worry anymore.

VIM’s community and plugin development is unmatched among other editors.

But what about the fuzzy finder in sublime? Or the auto indentation? Or the smart parenthesis handling?

Relax! No other text editor has as many developers working on plugins than VIM. Virtually anything that exists in another text editor which isn’t mouse driven has some very popular, very supported, very documented plugin you can use.

It may require a bit of extra setup beyond a .vimrc reference, but if you can setup a web app such that you edit it in a text editor, chances are you’re game enough to handle a settings file and some CLI’ing around.

Start with normal VIM - no plugins, no MacVIM, no nothing.

There are plenty of great plugins and alternatives to just plain old “vim” in a terminal - avoid them at first. You’ll be much better off with a solid base understanding before approaching plugin setup, plus if you ever have to quickly SSH into a box you won’t want to hassle with setting up VIM.

Next week I’ll have a basic intro to VIM if you’re interested in learning the specifics of getting started, but if you can’t wait, fire up your UNIX based terminal and try typing $ vimtutor.