I am trying out a new major mode, how can I take advantage of Emacs' documentation system to get a listing of key bindings available in that specific buffer?
C-h b will list all the bindings available in a buffer. This is a mnemonic for help (C-h) bindings (b).
You can also get a list of keybindings via
C-h m, which is help for the major and minor modes for the buffer. The formatting of this is a little clearer, but includes additional information about the modes beyond just listing the keybindings.
I use the command
helm-decsbinds, which is available via melpa. I mapped it to
C-h b because it is basically a drop-in replacement for
describe-bindings. The benefit is that it is easier to navigate and search than the output of
describe-bindings because you can easily search for keywords and the helm buffer will narrow to show all of the matches, and which mode they come from
For any selection in the list, you can choose to either perform the action, or to jump to the documentation for the command.
Although not the canonical
emacs way of doing things, I quite like using
discover-my-major for that purpose because it just feels more effective.
It is available on
melpa and is powered by the
makey library, which is responsible for those nice menus
magit is known for.
I'd suggest you check out the
github link for a screenshot demonstrating the functionality.
Install it (I'd suggest from
package.el) and add
(require 'discover-my-major) (global-set-key (kbd "C-h C-m") 'discover-my-major)
to your config.
Although not exactly what you are looking for you might want to try out guide-key. If you enter a prefix sequence without completing it guide-key will pop up a buffer showing you the available completions and what functions they execute. I find this very useful when I need to learn new bindings in Emacs.
You may want to look at
C-h m that lists all key bindings of major mode and minor modes. Read more about other Help commands here. Emacs help system is rich.
Icicles key completion gives you all of the info you get from
C-h b (
C-h w (
C-h c (
describe-key-briefly), rolled into one. Just hit
S-TAB anytime at top level.
Every key sequence that you can possibly type in the current context (with the exception of keys such as
qthat just insert characters) is displayed in buffer
*Completions*. This tells you which keys are available now.
The command that each key sequence is bound to is also shown in
*Completions*, next to the key name (e.g.
b = bookmark-jump). This gives you a rough idea what the key (e.g.
Each key sequence that is bound locally, that is, each key that has a special meaning for the current buffer mode, is highlighted in
*Completions*with a pale yellow background. This tells you which bindings are those offered by the current mode.
C-M-mouse-2on a key name (with its command name). A
*Help*buffer opens with a complete description of the command bound to the key. This tells you what the key sequence does in detail.
- Click another key (command) to get help on it, and so on… You can do this all day, browsing through the available key bindings to learn what they do. This is a great way, in particular, to learn about the keys defined by a given mode.
- Click any link in the
*Help*buffer to find out about stuff related to a given command and its key sequence. Navigate throughout the help system – you can do this all day too. Then pick another key to interrogate…
If you want to then use a key (command), then just click
mouse-2on its name in
*Completions*(or complete the key + command name and hit
RET). Or cancel, using
C-g, and hit the key as you would normally.
You can start with
S-TAB, to see all currently available keys. Or you can start by hitting a prefix key (e.g.
C-x) and then hit
S-TAB to see all keys that have that prefix (i.e., all keys available after you have hit that prefix key). (The "command" associated with a prefix key is indicated by
You can even complete menu-bar menus this way, by accessing the pseudo-function prefix key
See also this description