Emacs 101

Emacs has a notoriously steep learning curve, but even after all of these years there are advantages too numerous to name!

A few:

  • Open source
  • Can run in a remote terminal
  • No AI unless you add it
  • Key bindings are useful in other programs (and sometimes at the OS level)

It is also, by design, extremely configurable. Lately I've given over most of that work to the Doom Emacs configuration framework.

As far as the basics, these are the commands I use 90% of the time:

Opening and closing files

keysaction
ctrl-x ctrl-fopen a file
ctrl-x ctrl-ssave the current file
ctrl-x kclose the current file (kill buffer)
ctrl-x ctrl-cexit Emacs

Moving around

keysaction
ctrl-abeginning of a line
ctrl-eend of a line
ctrl-fforward one character
ctrl-bbackward one character
ctrl-ddelete one character forward

Selecting/cutting/pasting

keysaction
ctrl-spaceset a mark
ctrl-wcut marked region
ctrl-kcut to the end of the line
alt-wcopy marked text
ctrl-ypaste

Bonus keys

keysaction
ctrl-c p ?find references in a project
ctrl-c p ssearch for a string in the project files (requires ripgrep)
ctrl-c p aswitch between the currently open .c and .h file
ctrl-x bswitch between open files
ctrl-c p ffind file in current project