In Emacs, almost any keystroke, optionally combined with one or more modifier keys, or any sequence of such keystrokes, can be "bound" to any command.
Modifier keys naming convention
|Alt||A||Relatively seldom used in Emacs, because Meta is often "logically" mapped to the "physical" Alt key.||A-x||Type "x" while holding down the (non-Meta) Alt key|
|Control||C||C-x C-f||While holding down Ctrl, type first "x" then "f". (This runs the command find-file).|
|Hyper||h||Often not mapped to any key (by default).||h-x||Type "x" while holding down hyper|
|Meta||M||Often mapped to Alt on your keyboard||M-x find-file RET|| Either:
(M-x activates the minibuffer)
Then type "find-file" in the minibuffer, then Return.
|Shift||S||S-x||Type "x" while holding down Shift|
|Super||s|| On OS X this is the Command ⌘ key.
On other systems often not mapped to any key by default, or to Window or Menu if present
|s-x||Type "x" while holding down super|
By convention, when multiple modifiers are specified, they go in alphabetical order:not .
Printable cheat sheet for popular modes
Emacs ships with cheat sheets of common and useful key bindings. The pdf files are located in the refcards/ subdirectory of.
Change key bindings
You can add, remove and change key bindings for any command by using the Emacs Lisp function
- M-x global-set-key or M-x local-set-key
- Hit the key sequence you want to bind
- Type the command to bind to that key sequence
- Invoke Emacs configuration file. . The output you see is the full lisp command which does the binding. You can copy this to your
global-set-keybind keys globally (i.e.
global-mode-map), which means other modes would override key bindings set by
local-set-keybind keys in the current buffer major mode, which affects all buffers sharing the mode.