bindkey

NAME

bindkey - binds an editor command to a key or lists key bindings

SYNOPSIS

bindkey [-l | -d | -e | -v | -u ]
bindkey [-a] [-b ] [-k ] [-r ] [--] key 
bindkey [-a] [-b ] [-k ] [-c ] [-s ] [--] key command

DESCRIPTION

This command is a C-shell built-in command.

Without options, the first form lists all bound keys and the editor command to which each is bound; the second form lists the editor command to which key is bound; the third form binds the editor command command to key.

key may be a single character or a string. If a command is bound to a string, the first character of the string is bound to sequence-lead-in and the entire string is bound to the command.

Control characters in key can be literal (they can be typed by preceding them with the editor command quoted-insert, normally bound to '^V') or written caret-character style, such as '^A'. Delete is written '^?' (caret-question mark). key and command can contain backslashed escape sequences (in the style of System V echo(1)) as follows:

\a
Bell
\b
Backspace
\e
Escape
\f
Form feed
\n
Newline
\r
Carriage return
\t
Horizontal tab
\v
Vertical tab
\nnn
The ASCII character corresponding to the octal number nnn

\ nullifies the special meaning of the following character, if it has any, notably \ and ^.

OPTIONS

-l
Lists all editor commands and a short description of each.
-d
Binds all keys to the standard bindings for the default editor.
-e
Binds all keys to the standard GNU Emacs-like bindings.
-v
Binds all keys to the standard vi(1)-like bindings.
-a
Lists or changes key bindings in the alternative key map. This is the key map used in vi(1) command mode.
-b
key is interpreted as a control character written ^character (such as '^A') or C-character (such as 'C-A'), a meta-character written M-character (such as 'M-A'), a function key written F-string (such as 'F-string'), or an extended prefix key written X-character (such as 'X-A').
-k
key is interpreted as a symbolic arrow key name, which may be 'down', 'up', 'left' or 'right'.
-r
Removes key's binding. Be careful: 'bindkey -r' does not bind key to self-insert-command; it unbinds key completely.
-c
command is interpreted as a built-in or external command instead of an editor command.
-s
command is taken as a literal string and treated as terminal input when key is typed. Bound keys in command are themselves reinterpreted; this continues for ten levels of interpretation.
--
Forces a break from option processing, so the next word is taken as key even if it begins with '-'.
-u (or any invalid option)
Prints a usage message.