Be Genius


Bo Jeanes

I am an software engineer who has lived and worked in New York, Brisbane, Chicago, San Francisco, and now Melbourne. I primarily work in Ruby though am a functional programmer at heart and a fan of programming languages in general. In particular, I love Rust and Clojure but keep my eye on many langauges all the time.

Pure Evil

I love Vim. I take that back — I love modal editing.

Actually, I think very few people like Vim, it just happens to be the best kid on the block at modal editing. But, after using Vim (and, God, does it take a while to learn to use it), you are reduced to a pathetic teary wreck every time [you] have to use a text editor that isn't vim.

And why is it so debilitating to use something other than Vim for those who have honed their modal editing skills? Frankly, magic sauce of Vim is (mostly) made up from a few quite simple ingredients: motions, text objects, operators. There are plenty of cool tricks hidden inside Vim, but those three main things are the things you really miss, consistently, when using something else.

Every now and then, when forced outside of the comforting (yet somehow cold) embrace of Vim, the Vimmer flirts with Sublime Text 2’s vintage mode or IdeaVIM. We may even be impressed — but, eventually, something falls apart and the abstraction leaks.

Usually, this failure happens because the Vi(m) emulation layer often doesn’t implement motions, text objects, and operators. They just implement some keystrokes that appear to do the same thing in the same way — until you try something the developer didn’t preempt.

If I could have an editor that did these things properly, I would have no real attachment to Vim. I have other things about Vim that I love and would hate to lose but they aren’t unique and other editors (can) have them, too.

Luckily for me, I’ve been doing too much Clojure to ignore Emacs forever and 2 weeks ago, I switched. Here's how it played out:

Nope — not for me... But, wait! Let us try this Evil Mode so we can mock their pitiful attempt at modal editing (*evil laugh here*). What’s this‽ It’s actually good!

Inner dialogs aside, I’m not kidding; Evil Mode is stunning. It doesn’t have everything — but everything that it does have is built up using the same functions macros that you can use to extend it. Those are: (evil-define-state) (“mode” is an existing term in Emacs so what Vim calls modes, Evil Mode calls “states”), (evil-define-motion), (evil-define-operator), (evil-define-text-object), and a few others.

Evil Mode correctly implements the plumbing to wire these things together so that the Vim “language” which becomes natural and reflexive (e.g. di” -> “delete inside double quotes”, vt -> “visually select till space`) is completely preserved. If you wanted to define a new text object (e.g. a Ruby block), it is trivial to do so and all of the motions and operators will work flawlessly with it immediately. Frankly, it’s not even that nice in Vim.

At the end of the day, I’ve always hated things like VimScript and Vim’s single-threadedness but I could never walk away from a truly powerful (and mostly extensible) modal editing system. Now, that has changed; I get ELisp (which, for all its faults, is exponentially better than VimScript), a saner package system, and a level of extensibility that, by design, can never be matched by Vim. All that and I don’t have to give up modal editing? Hell yes!

Bonus points: one of the “states” that Evil implements is an Emacs state; this leaves Emacs and all it’s default behavior and keymappings 100% intact, meaning you can pair fearlessly with Emacsen, or slowly learn more about the Emacs way of doing things, if desirable.

So far, I’ve rarely noticed I’m not in Vim and am constantly surprised when I employ Vim reflexes in Emacs and they work exactly as expected or better (seriously, try :%s/foo/bar/g in Evil mode and tell me you don’t squeal with joy).

I refuse to pick a single side, so I’m picking both. I’m going to edit modally in Emacs and I’m going to be happy doing it! I don’t care if I simultaneously piss off Vim users and Emacs users — hell, they need more things in common anyway...


  1. Here is my evil mode story :)

    tl;dr, love modal editing, hate vim, love emacs, hate emacs editing. So now I use evil and literally map every single command I use to my own keys, completely ignoring default emacs keybinds.

    I am in this strange situation where i am getting pretty good at elisp, have written about 2-3 kloc of extension code, but still can't answer basic emacs questions.

    On top of that, every once in awhile I give another editor a try, and there will be realizations I gain from it. Like when I was using sublime for a few weeks, two main things I learned was a) m-x is way too hard to hit for what it is, so now I use m-P like sublime, and b) there are many things in vim that I am used to, but are absolutely horrible, like hitting :w every time I want to save (as an example) So at this point, I am using this bizarre amalgamation of ideas from many different editors, which totally makes sense to me, but probably nobody else in the world.

    As a fellow evil-emacs guy, here are my configs :)

    by Matt Briggs on

You need to login with GitHub in order to comment.