[[zh:热键分类]]
[[ja:カテゴリ・キーバインド]]
Click the heading for a list of pages related to this category.

Keys, or '''[[KeySequence]]s''', in Emacs are bound to [[Command]]s. Even a simple key like `s' is bound to a command (usually command `self-insert-command').

For information on setting actions to mouse buttons, the mouse wheel, or mouse movements, see CategoryMouse, a subset of this category (%%CategoryKeys%%).

For information on emulating other systems and software like ViKeys or CopyAndPaste bindings, see CategoryEmulation.

For more information on using menus, see CategoryMenus.


== Overview ==

* EmacsKeyNotation -- How to make sense of the [[KeySequence | keys]] shown in Emacs documentation.
* ModifierKeys -- Control ('''`C-''''), Shift ('''`S-''''), Meta ('''`M-''''), Alt ('''`A-''''), Super ('''`s-''''), Hyper ('''`h-'''') keys
* [[EmacsKeyBindingCriticisms|Logic behind default Emacs keys]] - the method behind the madness
* ShiftedKeys -- Shifted function keys are not available if they have no explicit definition.

== Discovery: What keys are available now, and what do they do? ==

* To find out what command is invoked by a given key, use `C-h k' (command `describe-key').
* To see which keys are bound to a given command, use `C-h w' (command `where-is').
* To see the currently bound keys, use `C-h b' (command `describe-bindings').

* [[Icicles - Key Completion]] -- Complete a key sequence. Show on-the-fly help about the currently available keys and their commands (including [[menu bar]] menus). See which are prefix keys and which are bound locally.
* ##guide-key## or ##which-key## -- Show help for current key bindings when you pause
* SearchKeybind - `occur'-like search of the list of current keys & their commands.
* [[ShowBindings|Show Bindings]] -- Display key bindings.
* [[PrintKeyBindings|PKB (Print Key-Bindings)]] -- Print key bindings in a pretty fashion, i.e. so that bindings are listed as on a computer keyboard and grouped by keyboard base-keys.

See also: MenuAccessFromKeyboard: using menus from the keyboard.


== Bind your own keys: keyboard, mouse, or menu ==

* [[ChoosingKeysToBind|Choosing keys]] to bind
* [[PrefixKey|Define prefix keys]] to group related commands
* [[http://www.nongnu.org/emacs-tiny-tools/keybindings/ In-depth info]] about binding keys, by JariAalto
* Libraries and code that might help you bind keys
** [[Hydra]] - Group related commands and repeat common commands
** KeyChord - Map pairs of simultaneously pressed keys to commands
** Let users of your code [[UseCustomizeForKeyBindings|use Customize]] to bind keys.
** BufferLocalKeys - Define keys local to a buffer, without affecting the [[major mode]] as a whole
** MultipleCommandsOnSingleKey - Bind multiple commands to the same key (in effect).
* [[DocumentingKeyBindingToLambda|Documenting a key bound to a lambda definition]]

== Dealing with modifier keys ==

* SettingMetaWithXKB -- Setting the meta keys with the XKB extension
* MetaKeyProblems -- Meta and Alt key confusion
* MovingTheMetaKey -- How to move your meta-key if it's not in the right position
* MovingTheCtrlKey -- How to move your ctrl-key if it's not in the right position
* SwapControlAltAndCapsLock -- Move all your keys around for ergonomic ease of use.
* StickyModifiers -- How to do without [[chord]]ing
* ControlLock -- Like caps-lock, but for your control key
* AltGrKey -- Emacs keys may be hidden because on Windows /AltGr/ + /Control/ + /key/ is just /AltGr/ + /key/
* FootSwitches -- assign Ctrl and other keys to pedal type switches
* EventApplyModifier -- Applying modifiers without a modifier key

== Using Menus ==

MenuAccessFromKeyboard provides info about using menus from the keyboard (without the mouse). A summary:
* [[TextModeMenu|Vanilla Emacs]] keyboard access to the [[menu bar]] (##tmm.el##).
* LaCarte -- Use completion to navigate the menu bar. Each leaf menu item is pre-expanded to include its ancestors -– for example, ##Edit > Search > String Forward##.
* [[Icicles - Key Completion]] -- Complete menu-bar menus.  Also, direct access to deep menu items.
* CategorizingInformationManager -- Navigate a searchable, sortable tree of menu items.
* TextMenu -- A substitute for ##tmm.el## that tries not to confuse the blind.
* IswitchMenu -- [[IswitchBuffers|Iswitchb]]-like menu-bar access.
* OneKey -- Customizable in-buffer menus.


== Solutions to common problems ==


* BackspaceKey -- How to make it right
* KeyboardRate -- Change keyboard rate from emacs.
* MissingKeys -- How to make undefined keys accessible
* ConsoleKeys -- Emacs keys on the Linux console, even C-M-H-internet
* FreeBSDConsoleKeys -- Fix minor issues on the FreeBSD console with a new keymap
* ScreenKeys -- Similar to the above, for screen(1)
* BindingControlReturn -- How to bind Control-Return in a local mode
* OpeningQuote -- How to type `this' easily on keyboards where only ' is easily accessed
* TabKey -- How to change the behaviour of the TAB key
* [[iTerm2]] -- For OSX users who use ssh, allows you to bind custom keys to escape sequences really easily
* [[Accelerate]] -- Change the behaviour of a command when its key is auto-repeated
* Lisp:speedkey.el -- Create a set of keybindings easily, with a help text
* [[keymap-unset-key]] -- Find keys that overlap in some keymaps and rebind them
* Binding <code><return></code> to `RET' -- If your version of Emacs does not bind <code><return></code> to anything, do this:  -- AlexSchroeder

             (global-set-key (kbd "<return>") (kbd "RET"))

== Tools ==

* XModMap -- Keys to work outside of Emacs as well; the X Windowing System uses xmodmap and xev, or xkeycaps
* LoadKeys -- Same thing, but for the Linux console using loadkeys, dumpkeys, and showkey
* XKeyCaps -- Graphical tool by JamieZawinski

[:CoolBindings]
== Keybinding suggestions ==
* DefineKeyLazy      a macro for define-key ,without writing (eval-after-load)
* [[next-line-2.0]] A keybinding that makes C-n and C-p work well with large buffers and long, wrapped, lines.
* Lisp:setup-keys.el -- Various key bindings, some for custom commands. See DrewsElispLibraries for associated command libraries.
* RepeatKeyDifferentBehaviors-- Binding multiple commands to the same key, for use sequentially
* DoReMi -- Use the arrow keys and mouse wheel to repeat commands, run commands in sequence, increment things, or cycle through enumerations.
* BackwardKillLine -- Same effect as `C-u' on a terminal; or `C-k' in the opposite direction.
* KillBufferUnconditionally
* QuickYes -- `M-y' shortcut to answer `yes-or-no-p'
* ReplaceRecentCharacter -- To quickly correct recent typing error
* Lisp:minibuf-electric-gnuemacs.el -- The one feature I used to miss under GNU Emacs, was the "electric" behavior for C-x C-f and other file-finding commands (under XEmacs, typing a slash or tilde first erases the default value in the MiniBuffer). Now it's available for GNU Emacs too! 
* BackwardDeleteWord -- Binding M-backspace to delete instead of kill.
* Lisp:singlebind.el -- Bind commands to single characters
* ErgoMovementMode -- Ergonomic movement commands: M-jikl
* FastNav -- Multiple commands to support quick jump to, replace at, kill at, etc. the next/previous occurences of characters.
* Lisp:smartrep.el -- Support sequential operation which omitted prefix keys.
* Lisp:unbound.el -- Find convenient unbound key sequences
* [[Keycentric]] -- centralizing keybindings into one place.

: In GNU Emacs, the ignored part of the filename is visible after typing a slash or tilde, at least until completion is performed with TAB. With the CVS version of GNU Emacs, the behaviour of XEmacs can be approximated by using <code>(file-name-shadow-mode 1)</code> and customizing either <code>file-name-shadow-properties</code> or <code>file-name-shadow-tty-properties</code>. -- MattHodges

== Bindings Inspired by MeatBall:HumaneInterface ==

MeatBall:HumaneInterface

* CapsKey -- Make Caps_Lock your Undo/Redo key, or an additional Ctrl key
* DedicatedKeys -- Use dedicated keys (ie. FunctionKeys unless you can hack hardware)
* DiskKey -- Save buffer, revert buffer, and find file with one key
* JumpKey -- Open files and browse urls with one key
* KillKey -- Kill buffers and end GnuClient connections
* QuasimodeSearch -- Search forward using Super, backward using Hyper
* OccurKey -- Switch to *Occur* buffer or run `occur'
* SwitchToGnus -- A true <nowiki>MailKey</nowiki>! 

There is also some /very/ creative suggestions for keyboard tweaking in the Ratpoison (a window manager for X11) Wiki that might be of interest to Emacs users as well:

* http://ratpoison.wxcvbn.org/cgi-bin/wiki.pl/Tweaks

== Health Issues ==

* StickyModifiers -- No more [[Chord]]ing.
* RepeatedStrainInjury -- How to avoid it
* [[esdf-mode]] -- a method to offload the arrow keys to the left hand

== Keyboard layouts ==

* DvorakKeyboard
* ColemakKeyboard
