A little while ago I came across Pete Corey’s post on using Spacemacs and the Olivetti package to configure a minimal, distraction-free writing environment. I’ve used a similar setup for the last couple years, but my implementation uses the Darkroom package instead of Olivetti.
Out of curiosity I decided to give Pete’s configuration a try. Unfortunately, I’m a little disappointed by Olivetti’s performance. It seems to make my whole instance of Emacs abnormally slow.
Since I’ve never run into comparable performance issues with Darkroom, I decided to throw together some quick instructions on how others can get it working.
Start by installing Darkroom from https://github.com/joaotavora/darkroom. Normally users add packages to Spacemacs via a configuration layer but, as far as I can tell, no such layer exists for Darkroom. That means we’ll need add it to Spacemacs as an individual package.
Open your configuration settings with
SPC f e d
and insert the Darkroom settings inside dotspacemacs-additional-packages.
dotspacemacs-additional-packages '( (darkroom :location (recipe :fetcher github :repo "joaotavora/darkroom")) )
Alternatively you can see Pete’s instructions in the linked post above on creating a separate layer, but for Darkroom instead of Olivetti. Either way works.
Next we’ll need an easy way to trigger Darkroom, so let’s create a keyboard shortcut for it. I prefer
SPC z d
where z calls zoom functionality, and d toggles Darkroom mode.
(defun dotspacemacs/user-config () (spacemacs|add-toggle darkroom-mode :status darkroom-mode :on (darkroom-mode) :off (darkroom-mode -1) :documentation "Turn on darkroom mode." :evil-leader "zd") )
From there, reload the Spacemacs config file with
SPC f e R
which will initiate Darkroom’s download and install. Spacemacs may need to be closed and re-opened to complete the install.
Once you toggle on Darkroom, you can adjust the left and right margin size with
CTRL ALT - and SHIFT CTRL ALT =
The default Darkroom font size is typically okay for me, but it is possible to scale fonts up and down with
SPC z x
and then hit – or = as needed.
And there you have it. Another minimal, distraction-free coding and writing setup in Spacemacs. Enjoy!