Key Command Meaning --- ------- ------- Up /dokey UP *cursor up Down /dokey DOWN *cursor down Right /dokey RIGHT *cursor right Left /dokey LEFT *cursor left Delete /dokey dch *delete character F1 /help help Home /dokey_home cursor to beginning of line Insert /test insert:=!insert toggle insert mode PgDn /dokey_pgdn *scroll forward a half screenful PgUp /dokey_pgup *scroll back a half screenfulIf you prefer PgUp and PgDn to scroll a full screen instead of a half, you should not redefine the bindings. Instead, you should redefine "
Esc Left /fg -< *foreground previous socket Esc Right /fg -> *foreground next socket
/def dokey_pgdn = /dokey_page" and
"/def dokey_pgup = /dokey_pageback".
Note: some emulators (NiftyTelnet, TeraTerm) incorrectly send ^[[3~ when PgUp
is pressed, but the correct meaning of ^[[3~ is Delete (in vt220 emulation).
The PgUp key in these emulators will not work correctly in tf unless you
(preferred) fix your emulator, or (easier)
"/bind ^[[3~ = /dokey_pgup"
(warning: may break your Delete key).
String Command Meaning
------ ------- -------
"^A" /dokey_home cursor to beginning of line
"^B" /dokey LEFT *cursor left
"^D" /dokey_dch *delete character to the right
"^E" /dokey_end cursor to end of line
"^F" /dokey RIGHT *cursor right
"^G" /beep 1 beep
"^H" (internal) *backspace
"^I" /dokey page *scroll forward 1 screenful
"^J" (internal) execute current line
"^K" /dokey_deol delete to end of line
"^L" /dokey redraw redraw (not clear) screen
"^M" (internal) execute current line
"^N" /dokey recallf *recall forward input history
"^P" /dokey recallb *recall backward input history
"^Q" /dokey LNEXT input next key literally (may be overridden
by terminal)
"^R" /dokey REFRESH refresh line
"^S" /dokey PAUSE pause screen
"^T" /kb_transpose_chars *transpose characters
"^U" /kb_backward_kill_line delete to beginning of line
"^V" /dokey LNEXT input next key literally
"^W" /dokey BWORD *delete backward word (space-delimited)
"^?" (internal) *backspace
"^X^R" /load ~/.tfrc reload personal config file
"^X^V" /version display version information
"^X^?" /kb_backward_kill_word *delete backward word (punctuation-delimited)
"^X[" /dokey_hpageback *scroll back a half screenful
"^X]" /dokey_hpage *scroll forward a half screenful
"^X{" /dokey_pageback *scroll back a screenful
"^X}" /dokey_page *scroll forward a screenful
"^[^E" /kb_expand_line expand current line in place
"^[^H" /kb_backward_kill_word *delete backward word (punctuation-delimited)
"^[^L" /dokey clear clear screen
"^[^N" /dokey line *scroll forward one line
"^[^P" /dokey lineback *scroll back one line
"^[ " /kb_collapse_space change multiple spaces to a single space
"^[-" start kbnum entry with -
"^[0" start kbnum entry with 0
...
"^[9" start kbnum entry with 9
"^[=" /kb_goto_match move cursor to matching parenthesis/bracket
"^[." /kb_last_argument input last word of previous line
"^[<" /dokey recallbeg go to beginning of input history
"^[>" /dokey recallend go to end of input history
"^[J" /dokey selflush selective flush (similar to "/dokey flush"
followed by "/limit -a")
"^[L" /kb_toggle_limit toggle between /unlimit and /relimit
"^[_" /kb_last_argument input last word of previous line
"^[b" /dokey_wleft *cursor to beginning of word
"^[c" /kb_capitalize_word *capitalize word
"^[d" /kb_kill_word *delete forward word
"^[f" /dokey_wright *cursor to end of word
"^[h" /dokey_hpage *scroll forward a half screenful
"^[j" /dokey flush jump to last screenful of text
"^[l" /kb_downcase_word *convert word to lower case
"^[n" /dokey searchf *search forward input history
"^[p" /dokey searchb *search backward input history
"^[u" /kb_upcase_word *convert word to upper case
"^[v" /@test insert:=!insert toggle insert mode
"^[{" /fg -< *foreground previous socket
"^[}" /fg -> *foreground next socket
"^[^?" /kb_backward_kill_word *delete backward word (punctuation-delimited)
Terminal keys
Some keys are interpeted by the terminal, not TF, so if you want to change
them, you must do so outside of TF (e.g. with stty in unix).
Typical unix terminal keys include:
When tf starts, it disables the terminal driver's "stop" and "start" keys
(typically ^S and ^Q), so they are available for binding within tf.
"Kbnum" argument
With the default keybindings,
ESC followed by an optional "-" and any number of digits sets the global
variable %kbnum.
By default, the current
%kbnum
value is displayed near the right end of the
status line.
Then, when any other keybinding is typed,
that keybinding may use the value of
%kbnum.
Whether the keybinding uses the value or not,
%kbnum is cleared after
the keybinding has run.
Most keybindings that use
%kbnum
use it as a repeat count.
For example, typing "ESC 1 2 x" is the same as typing
"x" 12 times.
For keybindings that have a sense of direction, negative values of
%kbnum reverse that
direction: for example, typing "ESC - 4 PgDn" is like typing
"PgUp" 4 times.
The "^G" (/beep) keybinding
does not honor %kbnum,
so it can be used to cancel it with no effect.
The variable
%max_kbnum
sets an upper limit on the value of
%kbnum
that can be entered by the ESC and digit keys, to prevent
typos from sending tf into very long loops.
To set %kbnum by means other than the default keybindings above, simply /set it as you would any other variable. Once it is set, all typed digits are appended to it. When any non-digit key is typed, that key will be executed, and %kbnum will be cleared.
/Def -B allows you to bind a symbolic keyname to a macro. There are several advantages in using symbolic key names over key code strings. First, you don't have to know what string is generated by the special keys on your keyboard. They will work on multiple terminals, based on the value of %TERM (assuming the keys are defined in the termcap database). Changing %TERM at any time will rebind the macros to the new codes.
The keynames recognized by tf are:
Unfortunately, even if your terminal has a particular key, your termcap entries may not define it, so you may not be able to use it by name. The arrow and function are pretty reliably defined, but many of the other keys are not. Also, some terminal emulators do not match all the key definitions.
They must be spelled as shown, but capitalization is ignored. The function keycode() can be used to find the string generated by a key (as defined in the termcap entry for %TERM).
Because TF runs in a terminal and not in a windowing system, it does not see actual keystrokes, but only the characters generated by a keystroke. If two different keys generate the same characters, TF can not tell them apart. In earlier versions, this meant that on many terminals TF could not distinguish the numeric keypad keys from arrow or digit keys, because they generated the same character sequences. Starting in 4.0 alpha 11, TF tries to put the keypad in "application mode", which on many terminals will make the keypad keys generate unique character sequences if Num Lock is on. Application mode can be disabled by setting %keypad to "off".
Note that before version 3.5 alpha 21 or beta 1, it was usually harmless to "/set TERM=vt100" on terminals that accepted a superset of vt100 display codes. However, the termcap key definitions are often different for terminals that are otherwise similar (e.g., vt100 and xterm share many display codes, but the key definitions are different), so setting %TERM incorrectly will interfere with the operation of named keys. Xterm users should also note that since 3.5 alpha 17, tf ignores xterm's ti and te capabilities that sometimes interfered with the operation of the scrollbar, so tricking tf with TERM=vt100 is no longer necessary.
At startup, tf also examines the terminal driver settings for keys corresponding to the /dokey functions BWORD, DLINE, REFRESH, and LNEXT, and binds them accordingly if different than the default bindings listed above.
See: /dokey, /bind, completion, %wordpunct, signals.