Spacemacs

A Vimmer’s Emacs Prerequisites

In a previous post I explained why Vim and Sublime Text ultimately disappointed me; in this one, I’m going to describe how I finally found at least temporary respite in Emacs and what it took to get me there.

I had a rocky start with Emacs. Actually I had about four of them. There was never any question that I was going to use Evil-mode, Emacs’s vi emulation layer. I understand that it arose from the ashes of several previous such efforts to become one of the most complete vi emulations available for any text editor besides ones that derive from vi itself.

Coming from Sublime Text’s deeply inadequate or flawed vi emulation packages, Evil was a revelation. With very few exceptions, it really is just like using Vim. It’s all that other crap that Emacs does that I had to make sense of somehow and that tripped me up the first several times I made a serious attempt at learning it.

One of the popular jokes about Emacs is that it stands for “Escape Meta Alt Control Shift”, a jab at the countless arcane key chords that you’re expected to use to invoke its mind-boggling array of features. Almost immediately, I decided that finding a way to avoid those chords in favor of using Vim-style key sequences mostly without modifiers would be a prerequisite for my using Emacs full time.

To make this distinction a bit clearer: The key command to quit Emacs is C-x C-c, which means “control-x followed by control-c”. Take a look at this table of Emacs commands and you’ll get an idea why there’s a whole flavor of RSI named for Emacs and why I wanted to just swap those key bindings out from the get go. What I really wanted was to bulk-convert all of Emacs’s RSI-inducing chords to key sequences like ones using Vim’s leader keys: for example, the aforementioned C-x C-c might become \xc or something.

My first pass at this had me using god-mode to take a bunch of the modifiers out of Emacs commands. But I had some trouble getting god-mode to play nice with Evil, even when I used the charmingly titled evil-god-state to tie the two together. I suspect that this was actually a perfectly viable way to achieve what I wanted and some misunderstanding on my part prevented me from getting it working; I was too new to Emacs and tried to deviate from its norms too much too fast. If you use evil-mode and god-mode together I’d be interested to hear how it works for you.

By this point I’d dipped my toes into Emacs enough to have a handle on Emacs Lisp, the (far superior to Vimscript) language used to do all of Emacs’s extensive customization. I’d tried the “build up an Emacs config from scratch” thing a couple times and ended up frustrated with it due to its being a total crap shoot whether any given plugin would play nice with evil-mode. So when I came across a starter kit whose tagline is “The best editor is neither Emacs nor Vim, it’s Emacs and Vim!”, and which purports to be “first intended to be used by Vim users who want to go to the next level by using Emacs”, I was 100% ready to jump feet-first into an unabashedly Evil-centric starter kit.

Spacemacs

Here’s the link to that starter kit, which is called Spacemacs. It takes Vim’s leader key idea and kicks it into overdrive with the help of a plugin that provides the same functionality in Evil, setting the leader key to space (whence the starter kit’s name) and using it to replace a whole bunch of Emacs chords with modifier-free key sequences.

This approach is pretty similar to the one I had in mind with evil-god-state, though it doesn’t automatically translate Emacs bindings like I’d hoped. But that turned out not to be as big a problem as I thought: Emacs does so much that I don’t really want to have it all at my fingertips. Manually setting up my bindings helps me compartmentalize, adding a few at a time and assimilating them while I note what continues to be most frictionful so I can try to ameliorate it in my next round of bindings. And Spacemacs sets up a ton of bindings for you, using a sort of “namespaced” hierarchy that allows all those bindings to avoid stepping on each other’s toes while also encouraging mnemonics and working well with a nice feature that aids discoverability.

That’s not the only way that Spacemacs is smartly designed. Its overall architecture is such that it’s (relatively) welcoming for the newbie but has a framework for sensible extensibility when you get further into it. I’ll explain some of the things that were most helpful to me in making Emacs with Spacemacs my full-time editor:

Getting Started with Spacemacs

Memorizing these bindings will enable you to get around in Spacemacs, if occasionally somewhat clumsily. They were my bread and butter before I started to do my own configuration. I’m only mentioning Emacs-specific bindings here; note that most of the basic functionality of Vim also works well in Spacemacs, like invoking Ex mode with : and using it to do things like save and open files, split windows, etc.

Those bindings, along with Spacemacs’s very good documentation of its own, should be enough to get you started on getting used to the brave new world of Emacs: if you’re a Vim user already, you’re probably familiar with the process of starting with a small set of commands and gradually incorporating new ones into your workflow as you learn where your friction areas are. You’ll have to go through that again with Spacemacs, but having a huge chunk of Vim’s functionality already available makes the process a lot smoother. I know, for example, that there’s a Spacemacs binding for saving a buffer, but I don’t yet know what it is because I always just use the Vim-style :w instead.

Hopefully that’s enough for you to get started using Spacemacs! It’s a really nice piece of work and it seems to be deservedly catching on like wildfire, so if you’re familiar with Vim and anything I’ve said here sounds appealing, you should give it a try.