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.
Create a new keymap named kmap.
|
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 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.
|
Read a key from the keyboard and execute the command associated with
it in the keymap, kmap.
|
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 the top level keymap to kmap. You might use this to swap
between several common keymappings or to implement modes.
|