Title: GNU Emacs
Date: 2021-03-14
So, I use [GNU Emacs][1] as my general text editor. [WordGrinder][3] is my word
processor, but anyting else, I do in Emacs. It's just the big text editor that's
always kinda worked along side how my thought processes function. I prefer key
combos over a CLI for commands, and a non-modal UX over a modal one.
What am I referring to there? Well, [VIM][4]. And before anyone goes off saying
that I obviously didn't learn VIM, I did. Thank you, [VIM Adventures][5], for
helping me with that, but yes, I used to use VIM. Quite a lot, in fact. Until
it almost drove me batshit.
See, the biggest difference between the two is their UX: modal, and non-modal.
VIM is a *modal editor* because it focuses about being in one of several *modes*
at any one time: *Normal*, *Insert*, and *Visual* being the main three.
*Insert* is what you'd expect from most GUI editors, where you type and it puts
characters into the editing field. *Normal*, however, is for editing and moving
around the document, as various alphanumeric keys are used as commands.
(Aside: *Visual* is for doing things like selecting text.)
For example, in *Normal Mode*, the keys `h`, `j`, `k`, and `l` are used to move
the cursor left, down, up, and right respectively. Using `e` moves to the end
of a word, while `E` (`Shift+e`) does so with different rules. `b` moves back
a word (`B` does so with similar rules to `E`), `w` (and `W`) go to the
beginning of the next word, `0` (the number) goes to the beginning of the line,
`$` (dollar sign) goes to the end of the line (the actual line, not the visual
wrap line), `gg` (two `g`s) goes to the first line of the document, and `G`
goes to the last line of the document. And trust me, there's more, but I'm not
willing to type it all out.
(Aside: You can use the arrow keys to move as well, but you'll catch hell from
many VIM users for it.)
To enter *Insert Mode*, you press... `i`, right? Well, yes and no.
`i` starts inserting *before* the cursor's position in Normal Mode, while `I`
starts it at the beginning of the line. `a` starts you typing in the space
*after* the cursor, and `A` puts you at the end of the line. Meanwhile, `O`
puts you on the line above the cursor, `o` puts you on the line below, and I
myself gave up around this time when using tutorials.
I mean, there's a [cheat sheet poster][6] that you can buy, and I still end
up confused when trying to use VIM. It just doesn't mesh with how my mind
tries to work.
Emacs, on the other hand, works just fine. And yes, there are [cheat sheets][7]
for Emacs as well, and I even have one from my printed copy of the *GNU Emacs
Manual 15th Edition*. But it's fairly easy to read, because you're usually in
only one of two "modes" while editing a file, if you can even call them that.
You're either typing into one of the editor buffers, or you're typing a
command into the minibuffer because you called for it.
Movement in Emacs is dead simple: arrow keys, Home/End/PgUp/PgDn. If your
keyboard doesn't have those keys, then you use a few key combos.
* `Ctrl-b` or `Ctrl-f` to move back/forward a character
* `Alt-b` or `Alt-f` to move back/forward a word
* `Ctrl-p` or `Ctrl-n` to move up/down a line
* `Ctrl-a` or `Ctrl-e` to move to the beginning/end of the line
* `Alt-a` or `Alt-e` to move to the beginning/end of the sentence
* `Alt-{` or `Alt-}` to move to the beginning/end of the paragraph
* `Ctrl-x [` or `Ctrl-x ]` (second key typed after the combo) to move to
up/down a page
* `Alt-<` or `Alt->` to go to the beginning/end of the document
(Aside: While looking for cheat sheets, I [came across one very similar to the
VIM one for Emacs][8], and it's not *nearly* as busy as its counterpart.)
I *know* these key combos well, but I hardly ever use them. I'm always using
my actual movement keys—sometimes using the keypad with the `Num Lock` turned
off—to move around any document I'm working on, and I don't have to switch the
mode just to return to my work. And if I do need to do something more complex
than basic editing, there are plenty of commands that I can use from the
minibuffer (`Alt-x`, then the command), assuming the command doesn't already
have a key combo that I could use.
BTW, Cut/Copy/Paste is done by using `Shift` and the arrow keys to select a
block of text and using `Ctrl-w` for cut, `Alt-w` for copy, and `Ctrl-y` for
paste. You can also use `Ctrl-Space` or `Ctrl-@` to mark the start, move to the
end, and use the cut/copy command in the exact same way.
And this is just the simple stuff. You can do things *just* as complex as VIM's
command system in *Normal Mode*, but it's not necessary to learn all of that
for simple editing.
Oh! And to save, it's `Ctrl-x Ctrl-s` one after another. `Ctrl-x Ctrl-c` quits
out of Emacs
-----
Of course, many people love Emacs because it's practically a single-tasking OS
on its own. It has a programming language in the form of [Emacs Lisp][9], a
built-in package manager, and even a built-in email and NNTP client, among an
absolute buttload of other features. And of course, you can install packages
for even more functionality, like a Mastodon client or RSS reader.
I don't really live in Emacs, but I've used many of these packages before. I
do prefer other applications, such as `mutt` for email, `lynx` for text-based
web browsing, `newsboat` for RSS, etc. But I do also appreciate the amount of
work people have put into making Emacs so amazing.
So, forgive me for gushing a bit over Emacs, but I do really love how well it
works for me.
[1]:
https://www.gnu.org/software/emacs/
[3]:
https://cowlark.com/wordgrinder/
[4]:
https://www.vim.org/
[5]:
https://vim-adventures.com/
[6]:
https://thingsfittogether.com/product/vim-cheat-sheet-advanced-print/
[7]:
https://imgur.com/RxlwP
[8]:
https://punchcard.wordpress.com/2010/10/09/emacs-movement-shortcuts-wallpaper/
[9]:
http://www.gnu.org/software/emacs/manual/elisp.html