I was wondering if there is anything in emacs which will help me remember keyboard shortcuts?
For example, if I press C-x and then press some key (say TAB), emacs should all possible combinations of C-X and other keys to give an emacs command (and also show what the command does)?
Keys can be bound to commands either interactively or in your . emacs file. To interactively bind keys for all modes, type M-x global-set-key RET key cmd RET . To bind a key just in the current major mode, type M-x local-set-key RET key cmd RET .
Binding Ctrl+c and Ctrl+x to both copy and cut and emacs keys.
Summary of essential emacs commands In the list below, C- means "control key", M- means "meta key" (escape).
There is a simpler way to do this than C-h m
. You can see all the combinations you need by pressing C-h
. Let me explain with an example. Say you want to run the command org-narrow-to-subtree
, which in my case is bound to C-x n s
I remember that I have to type C-x n
but don't remember the next part. I can type C-x n C-h
and emacs will show me the following:
Global Bindings Starting With C-x n:
key binding
--- -------
C-x n d narrow-to-defun
C-x n n narrow-to-region
C-x n p narrow-to-page
C-x n r narrow-to-region
C-x n s org-narrow-to-subtree
C-x n w widen
[back]
So in your case, to see all possibilities after C-x
, just type C-x C-h
You can use C-h m
to list and describe all active keybindings in current buffer (depending on your active major and minor modes).
Not a complete answer but partial:
I think one-key is what's your looking for One key
In Icicles you have key completion, which is just about what you described.
You know the help that is offered when you hit a prefix key and then C-h -- e.g. C-x C-h? Well that's just help, and it works only for certain prefixes.
What this Icicles feature is about is actually completing key sequences: hit C-x, then S-TAB to complete, and every possible completion of prefix key C-x is displayed -- just pick one.
If the candidate you picked is itself a prefix key (e.g. you picked r, so so far you're up to C-x r, which is still incomplete), then you pick another piece of the sequence, and so on, until the key sequence is complete (and its command is invoked).
See also:
You can complete key sequences too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With