Emacs

Updated 2022-09.

While Visual Studio Code may be the de-facto kind of the text editor world among programmers, the neckbeard tools of vim and Emacs aren’t unheard of.

Here are my notes related to “why I use Emacs”.

My Background

I started using Emacs because of its org-mode feature.

Before using emacs, I mainly used vim (and would aim enable vim keybindings in whatever tool I could). Even in Emacs, I do prefer vim’s modal editing.

Emacs and Vim Both Allow Keyboard-Driven Text Navigation/Manipulation

Emacs and vim are mostly driven using the keyboard.
The big benefit of being keyboard driven is not having to move your hand to move the mouse.
The downside to this there’s a steeper learning curve to learning the key bindings in either editor.

Or I’d summarise it like this:

VSCode Vim Emacs
Ease of use, coming from Notepad Easy Hard Hard
Learning Curve Do people learn VS Code? Hard Hard
Out of the box experience Usable Adequate Abysmal
Prefers GUI or terminal? GUI-only Prefers terminal Prefers GUI
Text Navigation with Keyboard No frills Expressively Modal Uses modifier keys
Extending Like writing an App with the terrible VimL comprehensive, with Lisp

Emacs and vim take different approaches to keyboard input:

Vim being ‘modal’ means keyboard input behaves differently depending on what ‘mode’ it’s in.
Vim has an ‘insert’ mode, where it behaves like common text editors.
In Vim’s ‘normal’ mode, though, the keys are used to navigate around and to maniputale text.
e.g. the letters hjkl are used for cursor navigation.
This manipulation tends to involve action + motion. The example I like is ci". Where c indicates “change”, i" indicates the motion “text inside ""”. e.g. with the cursor in printf("hello world"), inputting ci" is the same as selecting hello world and deleting it.

Emacs’ approach to “driven by the keyboard” is to use modifier keys like “Ctrl” (C-) and “Alt” (M-).
e.g. C-f/C-b move forward/backward one letter at a time, whereas M-f/M-b more forward/backward one word at a time. C-a/C-e move to the start/end of a line, whereas M-a/M-e move sentences at a time.

The use of modifier keys is sane enough that macOS input adopts many of the Emacs-style bindings. (e.g. “C-a” will move to the beginning of the line, “C-e” moves to the end).

So, while vim’s keybindings don’t resemble Emacs’ in the slightest, in a broad sense they’re similar in the sense that you don’t have to reach for the mouse to for navigations fancier than cursor keys + Home/End + PageUp/PageDown.
– Despite how crap the out of the box experience is, and that it’s got a steep learning curve, I would still absolutely recommend a programmer who cares about mastering their tools learn Vim keybindings.

The Doom Emacs Distribution is Great

I still think it’s something of a rite-of-passage to having a go at trying to configure an Emacs (or Vim) into something usable; especially for students who have the spare time to follow community guides and recommendations.

That could be thanks to the little yak-shaver in me that constantly wonders if there’s a more streamlined way to complete some task.

But, I gotta say. The doom emacs distribution has won me over.

It brings with it a good set of quality packages which enhance everyday code editing, as well as a well thought out set of keybindings for invoking these. (e.g. running npm run X is <SPC> m n r. Rather, <SPC> m is the prefix to all key sequences related to the local _m_ode. And then n r being to bring up node run isn’t too difficult to remember).

Great Things About Emacs (Hard to Find Elsewhere)

Org Mode

Org-mode is a markup format, with a long tail of features for organising: taking notes and managing tasks.

Magit

Maybe you’ve been fooled to think that programmers who know git would use git on the command line, and wouldn’t need to use a GUI.

Magit, however, is an excellent interface on top of git, that makes using the command line feel archaic.

Discoverability

Emacs’ great discoverability eases out much of the difficulty that comes from it being able to do so many things.

Extensibility

Useful Guides

Sacha Chua’s Visual Guide

http://sachachua.com/blog/series/a-visual-guide-to-emacs/
This is very cute, utterly fantastic.
She also links to some Emacs Beginner Resources.

Tuhdo’s Emacs Tutor

tuhdo’s emacs-tutor comes with large, pretty gifs of Emacs doing its thing.
I kindof like that it shows off feature based stuff at the start.

Somewhat apprehensive at the thought of a community which needs fancy-animated-gifs to get excited about anything, though: – I’m not sure about Emacs, but Vim at least has excellent help documentation.

awesome-emacs is a pretty good starting point.