When I first met vim, it was behind locked doors.  A friend who was a vim user brought it in and loaded it onto the internet-less machines we worked on in a secure lab.  I was floored that somebody could be so devoted to their text editor of choice as to burn it to a CD just so he could use it.  I tried to use it a couple times but slid straight back down the learning curve onto Notepad++ et al.

If there was ONE thing that changed my mind about vim, it’s this:

inoremap jk <esc>

Lemme `splain:

No, there is too much.  Lemme rant.

Tutorials and Practice

The most difficult part of using vim at first, for me at least, was navigation.  I had firmly committed to muscle memory using ctrl + <up> etc. to navigate and felt totally crippled without it.  So I knew the first thing I had to do was change my first-response reflex.  I needed to NEED to use the home row in order to navigate, because as soon as I couldn’t recall the right keys instantly, I just moved my hand and used the arrow keys.  I learned to touch type via gamification, so my first thought on how to learn vim was to find a game that’s played through that interface.

After a bit of googling, my first encounter with vim-adventures went well, but I was unemployed at the time and $25 for a temporary asset seemed a bit pricey.  So I’ve never actually played any levels beyond the paywall, but I enjoyed every moment before it.  After a bit more googling and a few false starts, I found Pac-Vim.  It worked perfectly for what I needed and soon I was darting around those ghosts like a pro.  After that, I found a cheat sheet I liked, laminated it all, and it began to feel like home.

Custom-made

I really took to Doug Black’s advice: Don’t put anything in your vimrc file that you don’t understand.  It emphasizes the development version of “skiing at your level.”  But I think the only thing I would add to that is “…or use.”  For me, the biggest benefit of using vim instead of anything graphics-based is that you can log in via SSH to almost any server anywhere in the world and, in a matter of seconds, be developing just as comfortably as if you were local.  However, the more things you add, the further you get from what comes built-in with most Linux distributions.  The more you ingrain what *is* built in, the faster you can edit on brand new server instances.

I don’t use too many packages, and my .vimrc isn’t very entertaining. Pathogen makes adding a new package super easy when I find one I like, but that’s *still* not going to help you settle in.

Having a seamless path from navigation to editing and back to navigation without leaving the home row is the key to becoming truly fluent in vim.  inoremap jk <esc> is the gateway to that.  With that in your vimrc file, pressing jk in rapid succession (like one second) is the same thing as pressing Esc (normally the only way from insert mode back to normal mode).  After a year, I would say the biggest hiccup I’ve ever had is when typing out the entire alphabet, you have to be careful not to type jk too fast.  That and you start typing jk whenever you’re editing anything outside of vim.  Between that key remap and actively trying to use all the little built-in shortcuts, I would say it only takes a few weeks to get “un-uncomfortable”.  I am quite proud to say that when I saw Amir Salihefendic‘s Top 10 Vim tricks you should know, I knew all but two!

You might not think that you spend a lot of time going between document editing and navigation, but when you add pressing the Esc key into that loop, it becomes painfully long.  However, when you not only cut out that extra motion, but ANY hand motion/distance, you start to realize just how much time you can save by not moving your hands from one place to another when there’s no real NEED for that.

It was never a choice

I had heard about the vim vs emacs debate a few times during my “hardware days” (undergrad, grad school, volunteer years).  I always expected to have some “bridge troll” moment where I was asked which will be my editor.  I just started using vim and was never consciously exposed to emacs at all.  I’ve only ever used it by accident until I realized you can switch your git commit message editor to vim, (I do almost exclusively in-line commit messages now).

I had never given my newfound bias towards vim a second thought until I heard Leo Laporte from Security Now say that the first thing he does when he gets a new computer is re-map CapsLock to Ctrl.  Apparently, Ctrl was originally where CapsLock is located, but CapsLock won the battle for position despite losing the war for relevance and use.  I don’t think there really is a wrong decision in the editor wars, and I also don’t think they’re mutually exclusive.  However, it does stir up memories of trying to learn the Dvorak layout while still having to use the Qwerty layout (tried it in college, definitely more comfortable, not worth the effort IMHO).  Muscle memory confusion abounds.

Browsing changed forever

There was a moment when I switched from preferring vim to advocating for vim, and that moment was when I discovered Vimium.  I can browse the internet without leaving the home row and yes, it’s as awesome as it sounds.  My only complaint, even though there is a built-in workaround, is how it collides with other shortcut keys like Youtube and Gmail.

So even though I don’t pose as a troll, forcing you to choose between them before I let you develop with me, I would ask that you choose through experience and not bias. I would also ask you which you chose and why.

Advertisements