Post by JustinHi,
I use emacs kind of frequently, but I can never remember the key-bindings.
If I'm using a X version I can do most of what I want with the menu, but
running as text only is not so easy.
So I was wondering if anyone has a cunning way of remembering the (most
common) bindings - I'm guessing there must be a structure to the key
bindings - i.e what do all the C-x commands have in common? And the M-x?
Why is save file C-x C-s, yet insert file C-x i, why not C-x C-i? Why is
list buffers C-x C-b and select buffer C-x b?
Are these unreasonable questions!? I have the feeling there's something
obvious out there to explain all this but it's just remaining beyond my
grasp!
Thanks in advance,
Well, Justin, I'll give you my observations about what I think was
intended when the default key bindings were created, point out to you
that you can always change key bindings (be careful, though, if you
redefine either C-c or C-x, these have multiple key sequences
associated with them, so you'd have to change a lot of things or lose
a lot of bindings).
In any case, I believe that the original rationale was to get as many
of the key and cursor movement functions on the primary control keys
as possible, associate small movements with the control keys, and
large movements of the same type with the M-x (either Alt or Esc,
depending on what you have available).
C-x is a prefix for the range of extended commands. You might
question why exiting takes multiple keystrokes? Well, you can
redefine it in any way that you want, but by default, the designers
tended to remain in editing sessions indefinitely (days, weeks,
months, ... longer?) and switch between multiple editing buffers to
edit files and perform a wide variety of other tasks.
C-a sends you to the beginning of the current line, M-a sends you to
the beginning of the sentence or to the previous beginning of a
sentence.
C-n sends you to the next line, C-p sends you to the previous line.
C-f sends you forward one character, C-b sends you back one character.
Similarly, M-f sends you forward one word and M-b sends you back one
word.
Each of these commands can be modified by a prefix, which has the
effect of either adding or multiplying to the amount of movement.
For example, C-u C-f will move you forward four characters and C-u C-u
C-f will move you forward sixteen characters, and M-25 C-f will move
you forward 25 characters. These modifiers can be used on most
commands and will have the effect of moving or modifying either
forward or backward, or repeating an operation a specified number of
times.
So the mneumonic f usually means forward, the mneumonic b usually
means backward, the mneumonic n usually means next and the mneumonic p
usually means previous.
Like most editors, after a while, you start running out of meaningful
mneumonics, so you do the best you can, either create a NEW mneumonic,
or choose something that's logicallly near other key selections on the
keyboard.
The vi editor has some really strange mneumonics to represent cursor
movement, yet they turn out to be very convenient once you get used to
them. Emacs chose a different way, some like it,.some hate it. Emacs
also gives you numerous choices, so if you don't like the defaults,
there are all kinds of Elisp programs out there that map all kinds of
different key sequences to match people's interests and preferences -
including at least three different Vi emulators that I can think of,
offhand.
I really think that the tutorial goes into much more detail than I
could possibly explain here, and between the C-h t tutorial and the
info pages (C-h i), you'll get a much more complete and accurate
description than anything I've attempted to extemporaneously explain
here. I do hope that I've whetted your appetite and provided some
possible explanations for the way things are. However, I am not the
definitive source of information on any of this, the resources that
come right with the software ARE those resource. I'm just hoping to
get you started, and hopefully I've been accurate enough not to steer
you the wrong way --- but if I have erred in any way, please refer to
the info and tutorial pages, plus apropos (C-h a) and all the other
useful tools that are available.
Best wishes as you embark on the journey!
--
Brian W. Masinick
mailto:***@yahoo.com