3

How to list all keybindings that have same prefix?

For example, M-g M-g is bound to goto-line.

How to list all the keybindings that have the prefix M-g?

5

4 Answers 4

3

M-g C-h or M-g F1 should do it. In general, pressing the prefix and then pressing C-h or F1 should give you the keymap at that level - and it works with multi-level keymaps as well.

For a complete explanation, look in the SO answer that @phils posted in a comment.

See also @Drew's answer to a similar question.

2

describe-bindings takes an optional argument PREFIX:

The optional argument PREFIX, if non-nil, should be a key sequence; then we display only bindings that start with that prefix.

Thus evaluating

(describe-bindings (kbd  "M-g"))

does the job.

2

I also enjoy the help the which-key minor mode offers; it saves a couple of keystrokes to find out the 'rest' of the key binding mappings.

2

Besides just M-g C-h, which @NickD mentioned, you can use library Key See.

Turn on minor mode kc-mode to enable completion on demand whenever you hit S-TAB, for keys and menu-bar menus. So M-g S-TAB shows you what M-g C-h shows you: the keys you can use after M-g. But you can also invoke one of them, by choosing it. (C-g to cancel without invoking any command).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.