Node: Key Maps, Next: , Previous: Keystrokes, Up: Keystrokes



Key Maps

All keystrokes exist inside a keymap. When you press the prefix key you are accessing the root keymap. By default all commands reside in the root key map and are accessed by pressing C-t.

There is also a top level key map, top. Any keystroke in this key map can be accessed simply by pressing the key. This is where the prefix key resides.

The following example adds a C-x b key binding to switch windows, much like C-x b in Emacs. See the functions below for full descriptions.

     # Create the key map
     newkmap ctrl-x
     # Bind b to 'select' on our new key map
     definekey ctrl-x b select
     # Attach our keymap to the top level key map via C-x.
     definekey top C-x readkey ctrl-x
     

The following functions control creating, editing, and deleting key maps.

newkmap kmap Command
Create a new keymap named kmap.

delkmap kmap Command
Delete the keymap, kmap.

bind Key command Command
Bind a key to a ratpoison command on the root keymap. This command takes two arguments: the key to bind and the command to run. For example, to bind C-t R to restart ratpoison:
          bind R restart
          

unbind key Command
Unbind a keystroke on the root keymap.

definekey kmap key command Command
definekey works exactly like bind except that it can bind keys on any key map (not just root).

undefinekey kmap key Command
Like unbind except that you pass it a key map in kmap.

readkey kmap Command
Read a key from the keyboard and execute the command associated with it in the keymap, kmap.

link key Command
Call the command that key is bound to. For instance link C-t would call the command other and switch to the last window.

describekey keymap Command
An interactive way to find the command bound to a given key on the specified keymap. This command will wait for the user to type a key. When the user does, the command will display the command bound to this key.

set topkmap kmap Command
Set the top level keymap to kmap. You might use this to swap between several common keymappings or to implement modes.