Function define_key has three positional arguments and three permitted keyword arguments.
The keymap in which to bind. See Keymaps to help find the most appropriate keymap for the binding you want to create.
The key sequence, given as a string, or a match predicate function.
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.
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.
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 key sequences like ] ] work.
1.1.6. $browser_object = ob
The given object will be used as the default browser object for the bound command.
Function undefine_key takes two positional arguments: kmap and seq. Undefines the binding given by seq in kmap.
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:
define_key(content_buffer_normal_keymap, "y", "copy", $browser_object = browser_object_dom_node);