This is a very quick introduction to Emacs.
Once Emacs is open, Emacs commands are prefixed with
Ctrl-x (usually written
C-x), which means to hold control and press ‘x’. This combination is a ‘keymap binding’, that is, there is a table of commands that follow
C-x, which allows different tables to be made for other prefixes (for instance
C-h). The first three commands you should know are:
C-x C-fthen type the name/path to the file you want (either to edit an existing one, or type a new name to edit a new one). This will open it in a “buffer” (analogous to a window), and anything you type in there will be saved with…
C-x C-swhich actually saves into the file. To then close Emacs and get back to your shell (probably
bash, I like
C-x C-cwhich will ask to save any unsaved files, and then close Emacs.
Note the names in the list, those are actual Emacs functions, which can be directly called by typing
M-x or (’M’ for ‘meta’, the alt/option key), and then typing the name of the function, of which there are many, you wish to execute.
I would also highly recommend going through Emacs’ built-in tutorial. When you first start Emacs, it should say how to do this, but as a reminder it’s
C-h t, hold control and press ‘h’, then press ’t’. Note that it’s not
C-h C-t; let go of control before pressing ’t’.
Since this editor has been in active development and use since the 70’s, there are many resources out there. Here’s a short list: