Site Tools


bind

Table of Contents

Synopsis:

bind
bind -DEFAULTS
bind <character_sequence>
bind -RECURSIVE <character_sequence>
bind <character_sequence> <action> <args>
bind -SYMBOLIC <symbolic_name> <action> <args>

Description:

BIND allows you to control how the client behaves when you enter a sequence of one or more keys. By default, the client binds most of the common key sequences to useful default values. You may not necessarily need to bind your own key sequences unless you do not like the default values.

Input to the client is broken into sequences. A sequence is a combination of 1 or more bytes that map to a key binding. Each time you finish a sequence, the bound action is performed. If you enter a sequence that is not bound, the sequence is ignored.

A sequence can be overlapping (ambiguous). You may bind the sequence ^[ (the escape key) to one action and ^[[A (cursor up) to another action. The client does its best to figure out which sequence you want to use by matching the longest valid sequence.

A binding can be deleted by rebinding it to the special action name NOTHING. Input to the client that does not fulfill a bound key sequence is simply ignored.

Sometimes your terminal will reserve certain control characters for its own use and never pass those characters onto application programs. For these characters (such as ^S or ^Q if you're using flow control), the client will let you bind them, but since you can't generate these keys, the bindings would never be used. This is not a bug in the client, but an unfortunate circumstance of having multiple layers of input handling.

You may want to include an unprintable character in your sequence and your text editor may not allow you to insert that character literally into a file. You may use the following printable character sequences as substitutes for the unprintable character you want to bind. Please note that you always have to backslash the \ and ^ characters if you want to use them literally.

If you want to bind Use the sequence
Ascii value 0 ^@
Ascii value 1 ^A or ^a
Ascii value 2 ^B or ^b
… and so on …
Ascii value 26 ^Z or ^z
Ascii value 27 (escape) ^[ or \e
Ascii value 28 ^\
Ascii value 29 ^]
Ascii value 30 ^^
Ascii value 31 ^_
Ascii value 92 (backslash) \\
Ascii value 94 (caret) \^
Ascii value 127 ^?
Any value 0-255 \nnn where <nnn> is an octal number from 000 to 177.

Key bindings are always case sensitive. Always.

Try to avoid binding single, printable keys to anything. By default they are bound to SELF_INSERT and you usually want to keep it that way. If you really screw things up, BIND -DEFAULTS will reset all of your keybindings to the original values, which will fix most problems.

If possible, it is recommended you use the symbolic name for the key (such as 'key_up'). The list of symbolic names is found in your system's terminfo man page (``man terminfo'').

If you want to see all of the sequences that are bound to a keybinding, use the rbind command.

The parse_command keybinding is the only binding that takes an argument.

Examples:

To bind control-Q (^Q) to QUOTE_CHARACTER /bind ^Q quote_character

To bind the right arrow (ESC-[-C) to FORWARD_CHARACTER:

    /bind ^[[C FORWARD_CHARACTER

(or better yet)

    /bind -symbolic key_right FORWARD_CHARACTER

#$EPIC: bind.txt,v 1.2 2006/09/18 12:42:25 jnelson Exp $

bind.txt · Last modified: 2021/05/27 16:52 by 47.128.20.250