1. define_key

Define_key has three positional arguments and three permitted keyword arguments.

1.1. Arguments

1.1.1. kmap

The keymap in which to bind. See Keymaps to help find the most appropriate keymap for the binding you want to create.

1.1.2. seq

The key sequence, given as a string, or a match predicate function.

1.1.3. cmd

This can be one of three types:

a string

The command named by the string is called when this binding is called.

a keymap

The given keymap becomes active when this binding is called.

null

Normally given when the $fallthrough keyword is given, signifying no action other than fallthrough. If null is given for cmd when the $fallthrough keyword is not given, the result is the same as undefine_key.

1.1.4. $fallthrough

When this keyword is given to define_key, it marks the binding as a fallthrough binding. This tells the input system to allow the keypress event to fall through to Gecko for processing by Gecko or the document in the current buffer.

1.1.5. $repeat = cmd

The given command will be called if this binding is called twice in a row. This is the mechanism by which sequences like ] ] work.

1.1.6. $browser_object = ob

The given object will be used as the default browser object for the bound command.

2. undefine_key

Takes two positional arguments, kmap and seq. Undefines the binding given by seq in kmap.

3. Examples

3.1. Default Browser Object

This binds the key 'y' in content buffers to the 'copy' command, and will cause it to prompt for any DOM node, instead of just links: