As I mentioned on Twitter, I’ve been experimenting lately with using a visually minimal Spacemacs setup. I’ve been using this new setup every day for several weeks, and I’m absolutely in love with it.
Want screenshots and an overview of how it works? Read on!
But First, Screenshots
Olivetti is an Emacs package designed to create a distraction-free writing experience within your editor. Most of Olivetti’s screenshots show it in the context of editing markdown. That makes sense, as the term “distraction-free writing” is usually applied to the context of writing prose.
But what if I want a “distraction-free writing” environment for writing code?
It turns out that Olivetti is still perfectly suited for the job. Check out a few screenshots of my current Spacemacs setup. Note that the screenshots below capture my entire screen, from edge to edge. There’s nothing behind the curtain here:
Spacemacs with Olivetti.
I’ve configured Olivetti to only activate when in prog-mode
, or in text-mode
. This means that things like Spacemac’s home buffer, and inline terminals retain their original layouts. This distinction has been working beautifully for me so far:
Spacemacs with multiterm.
Using Olivetti within Spacemacs
To get Olivetti working with Spacemacs, I needed an Olivetti layer. Unfortunately, an out-of-the-box Spacemacs layer doesn’t exist for Olivetti. Thankfully, the process of creating a custom, private layer isn’t a difficult one.
We can create a new private layer from within Spacemacs by running the configuration-layer/create-layer
command with M-x
(or SPC
+ :
). Let’s call our layer olivetti
. This creates a new ~/.emacs.d/private/olivetti
folder and populates a packages.el
file with some boilerplate.
We’ll replace the contents of packages.el
with the following:
(defconst olivetti-packages
'(olivetti))
(defun olivetti/init-olivetti ()
(use-package olivetti))
This tells Spacemacs that we need the olivetti
package, and to use the package once it’s been loaded.
Once that’s done, we need to edit our Spacemacs configuration file (SPC f e d
), and add an olivetti
entry under our dotspacemacs-configuration-layers
list to instruct Spacemacs to load our new private layer.
(defun dotspacemacs/layers ()
(setq-default
...
dotspacemacs-configuration-layers
'(
...
olivetti
)))
Finally, we need to configure Olivetti to run in prog-mode
and text-mode
. We can do this in our dotspacemacs/user-config
callback:
(add-hook 'text-mode-hook (lambda ()
(interactive)
(message "Olivetti text-mode-hook")
(olivetti-set-width 81)
(hidden-mode-line-mode)
(spacemacs/toggle-vi-tilde-fringe-off)
(olivetti-mode 1)))
(add-hook 'prog-mode-hook (lambda ()
(interactive)
(message "Olivetti prog-mode-hook")
(olivetti-set-width 81)
(hidden-mode-line-mode)
(spacemacs/toggle-vi-tilde-fringe-off)
(olivetti-mode 1)))
I use this opportunity to tune Olivetti and Spacemacs to my liking. Feel free to make any changes you deem necessary.
With that, we’re good to go!
How To Not Get Lost
The key to not getting lost without any visual indicators is to always know where you are!
That may sound like a truism, but visually paring down my code editing environment has made me realize that there is no substitute for deep understanding and mastery of your tools. I don’t need a modeline to tell me which mode I’m in if I already know. I don’t need a constant reminder of which line I’m on, when I can navigate directly to any given line with :
.
Many of the visual indicators that modern editors provide are really just noise. I’m not going to say that noise is never helpful, but you can almost always get by without it.
If you’re interested in seeing exactly how my Spacemacs is set up, you can see my entire .spacemacs
file here. It’s very ugly. I’m warning you now.