GNU Readline Library. Node: Binding Keys

PREVKeymaps UPReadline Convenience Functions NEXTAssociating Function Names and Bindings

2.4.3: Binding Keys

You associate keys with functions through the keymap. Readline has several internal keymaps: emacs_standard_keymap, emacs_meta_keymap, emacs_ctlx_keymap, vi_movement_keymap, and vi_insertion_keymap. emacs_standard_keymap is the default, and the examples in this manual assume that.

These functions manage key bindings.

Function: int rl_bind_key (int key, Function *function)
Binds key to function in the currently active keymap. Returns non-zero in the case of an invalid key.
Function: int rl_bind_key_in_map (int key, Function *function, Keymap map)
Bind key to function in map. Returns non-zero in the case of an invalid key.
Function: int rl_unbind_key (int key)
Bind key to the null function in the currently active keymap. Returns non-zero in case of error.
Function: int rl_unbind_key_in_map (int key, Keymap map)
Bind key to the null function in map. Returns non-zero in case of error.
Function: int rl_unbind_function_in_map (Function *function, Keymap map)
Unbind all keys that execute function in map.
Function: int rl_unbind_command_in_map (char *command, Keymap map)
Unbind all keys that are bound to command in map.
Function: int rl_generic_bind (int type, char *keyseq, char *data, Keymap map)
Bind the key sequence represented by the string keyseq to the arbitrary pointer data. type says what kind of data is pointed to by data; this can be a function (ISFUNC), a macro (ISMACR), or a keymap (ISKMAP). This makes new keymaps as necessary. The initial keymap in which to do bindings is map.
Function: int rl_parse_and_bind (char *line)
Parse line as if it had been read from the inputrc file and perform any key bindings and variable assignments found (see Readline Init File).
Function: int rl_read_init_file (char *filename)
Read keybindings and variable assignments from filename (see Readline Init File).
PREVKeymaps UPReadline Convenience Functions NEXTAssociating Function Names and Bindings