/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, terminal emulators often 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.
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 below.
Key Command Meaning --- ------- ------- Up /dokey UP cursor up Down /dokey DOWN cursor down Right /dokey RIGHT cursor right Left /dokey LEFT cursor left F1 /help help Insert /test insert:=!insert toggle insert mode Home /dokey_home cursor to beginning of line PgDn /dokey page scroll 1 screenful at --More-- prompt
String Command Meaning ------ ------- ------- "^A" /dokey_home cursor to beginning of line "^B" /dokey_wleft cursor to beginning of word "^D" /dokey_dch delete character "^E" /dokey_end cursor to end of line "^F" /dokey_wright cursor to end of word "^G" /beep 1 beep "^I" /dokey page scroll 1 screenful at --More-- prompt "^J" /dokey NEWLINE execute current line "^K" /dokey_deol delete to end of line "^L" /dokey redraw redraw screen "^M" /dokey NEWLINE execute current line "^N" /dokey recallf recall forward input history "^P" /dokey recallb recall backward input history "^R" /dokey REFRESH refresh line "^T" /kb_transpose_chars transpose characters "^U" /dokey DLINE delete line "^V" /dokey LNEXT input next key literally "^W" /dokey BWORD delete backward word (space-delimited) "^[^E" /kb_expand_line expand current line in place "^[ " /kb_collapse_space change multiple spaces to a single space "^[-" /kb_goto_match move cursor to matching parenthesis/bracket "^[." /kb_last_argument input last word of previous line "^[J" /dokey selflush selective flush (flush non-hilited text) "^[_" /kb_last_argument input last word of previous line "^[b" /fg -< foreground previous socket "^[c" /kb_capitalize_word capitalize word "^[d" /dokey_dword delete forward word "^[f" /fg -> foreground next socket "^[h" /dokey hpage scroll half screenful at --More-- prompt "^[j" /dokey flush flush (discard text after --More-- prompt) "^[l" /kb_downcase_word downcase word "^[n" /dokey searchf search forward input history "^[p" /dokey searchb search backward input history "^[u" /kb_upcase_word upcase word "^[v" /test insert:=!insert toggle insert mode "^[^?" /kb_backward_kill_word delete backward word (punctuation-delimited)
stty
in unix).
Typical unix terminal keys include:
See: /dokey, /bind, completion, %wordpunct, signals.