Spacemacs

Spacemacs, a “new” editor.

Although I started programming in Vim, I only managed to learn the basic keystrokes. I’ve heard of Emacs but didn’t have the chance to try it out. People are saying that Spacemacs is a great combination of the 2, gave me motivation to try out the Emacs environment, without relearning the keystrokes used for editing.

Another benefit of using Spacemacs is that it uses a lot less resources than Atom. As I am now programming on a 12" Macbook, it is not a good machine to run Atom. Spacemacs on the other hand, allows me to maintain the battery life of this amazing machine. The longer the battery life can last on this machine, the more can be done in a single sitting in a cafe.

I’ve been using Spacemacs as my primary editor for a while now and will continue to do so for the next 6 months. We will come back to review it again then.

What Spacemacs is

Spacemacs is less a fork of Emacs than a distribution of it, the way Ubuntu relates to Linux. You get a curated set of packages, a default configuration that already works, and one big organizing idea: layers. A layer bundles everything an editing mode needs, the packages, the keybindings, the snippets, and you turn a language on with one entry in .spacemacs:

(defun dotspacemacs/layers ()
  (setq-default
   dotspacemacs-configuration-layers
   '(ruby
     html
     git)))

Enabling ruby installs and wires up the Ruby packages, and adding a layer is the whole job. The editor stops being a configuration project you maintain and becomes a product you configure.

The Vim side comes from evil-mode, a near complete implementation of Vim inside Emacs, with operators, text objects, registers and counts. Modal editing then works in every buffer, including magit and dired, which neither Vim nor Emacs gives you on their own.

The memory argument, spelled out

The resource point in the first half of this post has a mechanism behind it. Atom runs on Chromium, so an Atom window carries a browser’s appetite for memory. Emacs runs as a single native process, and run as a daemon it starts once; every frame you open after that is a cheap client attaching to the running instance. On a 12" Macbook the difference shows up in the battery meter by the second coffee.

Discoverability

The trap with modal editors is that the keys are invisible until you know them. Spacemacs answers with which-key: press the leader key, space, and a panel shows every available follow-up key with its command. Mnemonic groups hang off it, SPC f for files, SPC b for buffers, SPC p for projects, so the editor teaches its own bindings while you use it. Coming from Vim with only the basic keystrokes, that panel is what turns “an Emacs I can operate” into “an Emacs I can learn”.