Usage:
/BIND sequence =
command
Creates a macro that will be executed
when sequence is typed at the keyboard. The sequence may use
^key notation for a control key, and \number for an ascii
character code in octal, hexadecimal, or decimal. For example, the escape
character can be given by any of these forms:
^[
, \033
, \0x1B
, or \27
.
When the key sequence sequence is typed at the keyboard, command is executed. The command is actually a macro body, so all the substitutions described under "evaluation" will be performed. The most common command used with a key binding is /dokey.
At startup, TF defines bindings for /dokey BSPC, BWORD, DLINE, REFRESH, LNEXT, UP, DOWN, RIGHT, and LEFT based on your terminal settings. Also, the standard macro library defines a set of (invisible) default bindings, one for each of the /dokey functions.
If /bind fails for any reason, it returns 0. Otherwise, it returns the number of the new macro (useful in /undefn and /edit).
As of version 3.5, the NUL character (^@) is allowed in keybindings.
The command
/bind sequence =
command
is equivalent to
/def
-b"sequence" =
command
.
Examples:
/bind ^Xtw = :jumps to the left%;:steps to the right! /bind ^[q = /set more off /bind ~ky = /input Kyosuke
See: keys, /dokey, /unbind, /input, utilities (bind-bash, bind-emacs, completion), general