开发者

Learning emacs - useful mnemonics?

开发者_运维知识库

Are there any mnemonics or patterns that make memorizing emacs key combos easier?


Well, the main important ones are: `

  • C-k to "Kill" a line and C-y to "Yank" it back from the kill buffer (aka: clipboard).
  • C-s to "Search "
  • C-h for "Help"
  • C-t "Transpose" two characters.
  • C-p "Previous" line
  • C-n "Next" line
  • C-f "Forward" char
  • C-b "Backward" char
  • C-e "End" 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.


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.


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.


Don't memorize it, just USE it.


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".


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜