Keyboard bindings in Emacs are managed via general.el:
To show all of your documented bindings, press C-h B (M-x general-describe-keybindings). Thankfully this does not show every
single binding, because that would be overwhelming. This only shows
those bindings that are documented in your init.el via the
use-package :general config. Use C-u C-h B to filter the table
to the current buffer minor modes.
To see a complete list of bindings for the current buffer, press
C-h b (M-x describe-bindings). This shows an exhaustive list,
but only for the current buffer modes.
As you learn new keybindings, you should document each one in your own
init.el, and then they will show up in the
general-describe-keybindings list. This way you can “own” the
default keybinding and it creates your own personalized cheat sheet:
;;; Example:;;; Your custom global bindings for Emacs builtin functions::(general-define-key
"C-h B"'general-describe-keybindings"s-b"'quick-switch-buffer"s-B"'buffer-menu-other-window"C-x B"'buffer-menu-other-window"s-o"'browse-url"C-;"'comment-region; C-u C-; to uncomment"s-<down-mouse-1>"'mouse-drag-region-rectangle )
;; The Emacs default bindings that you did not change, but you still;; want to remember (these will show up in general-describe-keybindings):(general-define-key
"M-SPC"'cycle-spacing; If you document it, you will use it."M-h"'mark-paragraph; C-h B is like your personal cheat sheet."C-h b"'describe-bindings"C-x 4 c"'clone-indirect-buffer-other-window)
;; To create global keybindings for optional packages, do this inside;; the use-package :general config:(use-package amx
:general
("M-x"'amx"<menu>"'amx))
;; You can customize the bindings of specific modes too:(use-package paredit
:general
(:keymaps 'paredit-mode-map"C-<right>"nil"C-<left>"nil"s-<right>"'paredit-forward-barf-sexp"s-<left>"'paredit-forward-slurp-sexp))
Here we capture the general-describe-keybindings output in org-babel
block:
;; Capture Emacs general keybindings in org-mode block:(with-temp-buffer
(let ((output-buffer (current-buffer)))
(with-current-buffer "*General Keybindings*" (copy-to-buffer output-buffer (point-min) (point-max))))
;; prepend two spaces to every line to circumvent regular org-mode parsing: (replace-regexp-in-string "^"" " (buffer-string)))