Vim: Text editor and Extension of your will

Some tasks are so mundane and seemingly simple we just don’t bother asking if there’s a better way.

This is the story of being forced to ask that question, and the educatinon that changed almost everything about the way I work… (For the better)


Long ago, in my teens, I wanted to start programming, and went for the most professional choice: Borland C++ Builder 3.

And failed both miserably and expensively.

I did more research and found something less structured and more forgiving: Perl. But, Perl was Linux only, and all I knew about Linux at the time was that it, and all the programming tools and languages on it were, unbelievably, free. That was really all I needed to know.

Getting Linux installed back then was pretty hard for a newbie, and the learning curve was ridiculous, but after weeks of effort and countless false starts, I was rewarded with a blinking command prompt (just text input and output).

Getting the pretty graphics working meant editing config files without a mouse or (gasp!) Windows Notepad.

To edit those files I had to type in an odd command to open an even odder text editor: Vim.

I thought I’d learn Vim just to edit files to get graphics working. To use it, you needed to press i to edit the file you opened, which felt like turning a key to start a car, and then turning another key to actually use it. I didn’t really understand it at the time, but I didn’t really need to.

Press i to edit, press escape and :wq to save. Sure. Whatever.

Using hjkl to move instead of the arrow keys wasn’t weird because I played the game Nethack, which uses the same keys to move. It was probably Nethack that kept me using Vim even after the graphics were working and I had my choice of editors with amazing, cutting-edge features like:

  • Mouse support
  • Colors
  • A GUI (Windows 3.1 is winning in this category)
  • Picture buttons
  • Clicky-wicky bits

Vim kind of felt like a game, and using only the keyboard made me feel like I was in the movie Hackers, where everyone just pounds on the keyboard as windows open and close and text scrolls across the screen.

Movies still like ignoring the mouse. The mouse is slow and telegraphs actions, letting the audience know what’s about to happen. If someone moves a mouse pointer to something you know they’re about to click it.

But when the hero just mashes the keyboard and things happen, it looks more like magic.

If you don’t believe me, browse to press F11, and just start mashing the keyboardSeriously, do it. It’s fun.

I remember (fondly!) a coworker mocking me for pretending to type things by just mashing the keyboard. Confused, I showed him that with Vim, I was actually doing stuff. It looked like magic to him and that was enough for me. I was hooked.

So Vim was like a game, and it made me look cool and feel cool, but as I used it, I realized something even more addicting. Much like a skilled craftsman’s hands know exactly what to do to perform a task, my common editing tasks were becoming automatic through muscle memory.

When I thought “Save and quit”, my hands had already typed <Escape>:wq. I couldn’t even finish the thought “I need to delete this line and type something new” before my hands had already typed ddo. When I spotted “teh” two words ahead of my cursor, my hands had already typed wwlxp. I edited text almost as fast as I could think.

Vim had become an extension of my will.

An appendage I moved naturally through ones and zeros.

Forget movies, this really did feel like magic.

Unfortunately, my Vim education stopped there. For years. Even after I started programming professionally, Vim was just press i, type stuff, and :wq. Of course, there some odd commands thrown in to move the cursor better than the arrow key replacements. But Vim was just a cooler version of notepad that had features to bypass the mouse. I had everything I needed so I had no reason to go further.

Fast forward to my new job, and one of my coworkers is a Vim user too! There’s a little comradery between Vim users the same way there’s a comradery between anything with two major camps.

Vim vs Emacs, Chevy vs Ford, 1911 vs Glock, etc.

As I found myself spending more time editing text, I slipped back into Vim easily, but my coworker was on another level entirely.

I thought I had magic, but she moved columns of CSV files, text, and refactored code faster than I could even visually keep up. I felt like that coworker who mocked my apparent keyboard mashing. THIS was magic.

So I started looking into advanced Vim skills, and realized that I had been missing more than what keys did what; I had been missing the actual design of Vim.

I’d been using a car as a radio.

Using a grand piano as a table to write music.

I had been using a tiny, tiny fraction of the power of Vim. What fraction I had been using, I had been using superficially.

I was using a paintbrush to draw stick figures while others used the same to create masterpieces.

I was embarrassed.

It’s been a year or so of diving deeply into, not just how to USE the Vim, but how to THINK in Vim.

Motions, objects, and edits dovetailing perfectly together to bring this magic to a whole other level. Now, I don’t write code to reformat a 50,000 line file, I do it live in Vim. I don’t even write substantial emails outside of Vim. The editing takes too long. This post was written in Vim, and even now as I adapt it to WordPress’s text entry field, I still write jk[space]hcw to stop typing, enter command mode, go to the beginning of the line and change the first word.

It’s automatic.

This editor is my tool of choice for so much, and I’m so much richer, better, and many times faster at almost all my work for having mastered it. It’s a force multiplier, to borrow a military term.

As with most things I dive into, I try to perfect my understanding before I try to fix, so I’m very light on plugins. I just want to learn the full potential of Vim and use it correctly.

It’s said that only a master can out-shoot his rifle. Only by reaching the zenith of your physical and mental skills, can you look at your rifle and say, “I am capable of more accuracy than this rifle can mechanically deliver.” I hope to one day achieve that level with Vim, but I truly can’t imagine it coming anytime soon.

No matter how remedial the video or website, you’ll almost discover something new that you can work into your workflow. Some tiny piece you’d never heard of before that makes you question if you’ve even begun to scratch the surface.

Technically, Vim is older than I am, and I’m not sure if I’ll ever catch up. But I still improve, and I still enjoy watching people see the magic for the first time.


© Copyright applies, details in sidebar

Vim: Text editor and Extension of your will

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s