A Software Designer's Blog


Beginning Spacemacs

18 Jul 2015

And So It Begins

So You Wanna Learn Emacs?

The best editor is […] Emacs and Vim! -Spacemacs

How I Got Here

A little background about my (lack of) vim skills. I use vim keybindings quite a bit in Visual Studio, via VsVim (thanks Jared Par!), however I’m really a novice, despite heavy usage of the most basic commands. Over the years I’ve invested in learning tools like Resharper to speed up my development, but at LambdaConf this year I met Andrew Cherry (@kolektiv) and in the course of discussing all things F#, he mentioned that he does most of his development on OSX in Emacs. Then I saw that Chris McCord of Phoenix fame had moved from Vim to Emacs Evil mode. I’d always intended to make an earnest attempt to learn the same, but this renewed my resolve. I didn’t want to lose all the things I learned in Vim, so Spacemacs FTW!

Getting Started

Like a lot of folks, I work on a Macbook Pro. Here’s some prerequisites for getting started with Spacemacs:

brew tap railwaycat/emacsmacport
brew install emacs-mac
brew untap railwaycat/emacsmacport

So, now you’ve call a well-maintained version of Emacs for your Mac. Now, we’re going to “install” Spacemacs:

git clone --recursive https://github.com/syl20bnr/spacemacs ~/.emacs.d

That’s it! Installation is just cloning the repo in your Emacs configuration folder. You’ll customize Spacemacs indendently, so you can always “re-install” by doing the following:

cd ~/.emacs.d && git fetch && git reset origin/master --hard

Your initial launch in Spacemacs is a little bumpy: open emacs, allow it to update, restart. Then Update it manually (you can hit tab to navigate the buttons), then:

git pull --rebase
git submodule sync; git submodule update

Restart emacs, you should be in business. Our next task is to arm our Spacemacs with great tools. These are installed by specifying “layers””. To edit ~/.spacemacs type SPC f e d and pick your layers by adding them to dotspacemacs-configuration-layers. My first layer was getting zsh working well.

(shell :variables
            shell-default-shell 'multi-term
            shell-default-term-shell "/bin/zsh")

The following settings were about getting utf-8 characters in the terminal, but I switched to a simpler zsh theme in emacs mode as advised by (this article about using multi-term)[http://rawsyntax.com/blog/learn-emacs-zsh-and-multi-term/]. So, you can ignore these, but I’m recording it here:

(defadvice multi-term (after advise-multi-term-coding-system)
    (set-buffer-process-coding-system 'utf-8-unix 'utf-8-unix))
  (ad-activate 'multi-term)
  (prefer-coding-system 'utf-8)
  (setq system-uses-terminfo nil)

Anyway, you’ll want to update your zsh color settings per this (SO answer)[http://stackoverflow.com/a/26549524]

export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export TERM=xterm-256color

Cool, one last thing for this getting started note; get your OSX layer working. It’s pretty simple:


Spacemacs layers are all about making the Emacs ecosystem available via vim-style keybindings, but they’re also a well-curated bundling of Emacs modes. I mentioned being a vim novice, but I did pick up a few tricks from Chris McCord. I used CtrlP and NerdTree via vundler. Spacemacs comes with helm and Neotree out of the box. Some commands I’ve been using a lot are:

The menus are easy to navigate, but you’ll soon be ripping through these commands. Chris

Magit, or OhMaGit

I’m pretty comfortable with git. I’ve been using it since 2009, but only truly regularly since 2010. I’m no expert, but I can do anything I want with the tool pretty quickly. Right now it’s still way more pleasant for me to Spc ' (open my shell) and just issue git commands, but Magit is pretty rad. One thing I really like is being able to selectively modify the hunks I’m staging, and I can tell using the Magit layer via Spc g ... is going to be a lot faster than shelling out. Just be sure you have a cheatsheet open and force yourself to use the Magit major mode and keybindings.


Some of the layers I’m really digging include javascript and elixir. I’ve still got some kinks to workout, but I can’t imagine using another tool to program in these languages now.


I’d heard about Dash before but not gotten into the habit if using it; the eponymous layer in Spacemacs will change that, I think.

Next Steps

There is a ton to learn, but I think it’s an investment that will pay off. I’m going to start using Spacemacs as my primary editor as much as possible. There are C# and F# layers that I hope will make that possible, and I’ll be using the VMWare shared folder feature to edit the files in Spacemacs in OSX, then switch over to the Windows VM to compile and such. Besides that, I’d like to develop more proficiency with macros; stuff like this is just cool:


I mentioned in the introduction that I’m learning Spacemacs in no small part because other folks I admire use Emacs. My ultimate hope is that I will gain enough productivity to be able to produce OSS at the levels they do. My existential angst came from the feeling that having invested the kind of time required, I’ll have committed myself to being a certain kind of person–a hacker–but in truth, I made that decision long ago.