问题
Are there any mnemonics or patterns that make memorizing emacs key combos easier?
回答1:
Well, the main important ones are: `
- C-k to "
K
ill" a line and C-y to "Y
ank" it back from the kill buffer (aka: clipboard). - C-s to "
S
earch " - C-h for "
H
elp" - C-t "
T
ranspose" two characters. - C-p "
P
revious" line - C-n "
N
ext" line - C-f "
F
orward" char - C-b "
B
ackward" char - C-e "
E
nd" of line - C-a .... a is the beginning of the alphabet, so "
A
beginning" of line
Other than that I mostly use the arrow keys, the mouse, the menus, or a select group of actual commands. The few exceptions to this (eg: macro creation and use) I learned pretty much by muscle-memory.
回答2:
Regarding patterns, yes, there are very obvious patterns that occur all over.
C-f forward-char
M-f forward-word
C-M-f forward-sentence/expression
C-b backward-char
M-b backward-word
C-M-b backward-sentence/expression
The pattern being C- applies to the smallest unit (char), M- applies to the next larger unit (word), and C-M- applies to the largest. For programs the units are chars, words, sexps.
回答3:
There is also Spacemacs, an Emacs distribution that introduces completely restructured key sequences, in order to be more mnemonic.
Almost every shortcut is started using SPC, initiating the sequence, followed by more single keys, selecting the context and then the actual command; e.g. SPC f s in oder to save a file, or SPC f S in oder to save all files.
Other context examples are
- b for buffer,
- w for window,
- s for search, or
- x for text manipulation and many more.
It seems to be very well structured.
Unfortunately I haven't used it, and I don't know whether you have to use Spacemacs or how easily it can be transplanted from its configuration into your own Emacs configuration.
One more remark: It advertises to be the best of both worlds (Emacs and Vim), but you do not need to use the vim
editing-style
.
回答4:
Don't memorize it, just USE it.
回答5:
If I need to remember something like C-c M-j = cider-jack-in, I think of it as Craig Charles and Michael Jackson at a bar, with Craig Charles ordering the first round "cider and jack".
回答6:
The most common ones are elaborated in the emacs tutorial -- C-h t. Read it from the beginning, carefully. Even if you don't read it all the way to the end, it should help you remember the rationale behind the most common keys better.
来源:https://stackoverflow.com/questions/2677300/learning-emacs-useful-mnemonics