.ds [ [\\s-2 .ds ] \\s+2] .ds _ \\v'+0u'\(ru\\v'-0u'\| .if t .ds .3 .4v .if n .ds .3 1v .if t .ds Es \\e\\h'-.3m'\"Backslash too wide on Harris .if n .ds Es \\e .TH BTERMINAL 5 local .tr ** .SH NAME bterminal \- adapting the .I B system to your local terminals .SH DESCRIPTION The .I B system uses the termcap library to address the terminal, and determines the codes sent by your terminal's function keys from the termcap database. To this end it uses the environment variables TERM and TERMCAP to determine the type and capabilities of your terminal. (See .IR tset (1) and .IR termcap (5) for the exact use of termcap.) .LP You can also redefine the binding of editing operations in a .I "key definitions file." There are a number of places where this file can be found, so that there can be different key bindings per terminal and per user. It is even possible to define an environment variable giving this place. .SH DEFAULT KEY BINDINGS The following table gives the names of the editing operations, and the default bindings. .LP .in +2c .ta 3c 6c .if n .ta 12n 32n .nf Name Default bindings Termcap bindings .sp \*(.3 accept ^\|I (1) return ^\|M widen "\*(Esew" \fIk1\fP (2) first "\*(Esef" \fIk2\fP last "\*(Esel" \fIk3\fP extend "\*(Esee" \fIk4\fP upline "\*(Eseu" \fIk5\fP previous "\*(Esep" \fIk6\fP next "\*(Esen" \fIk7\fP downline "\*(Esed" \fIk8\fP up "\*(EseU" \fIku\fP down "\*(EseD" \fIkd\fP left "\*(Ese," \fIkl\fP right "\*(Ese." \fIkr\fP goto ^\|G undo ^\|H redo ^\|U delete ^\|D copy ^\|C record ^\|R play ^\|P look ^\|L help "\*(Ese?" exit ^\|X .sp \*(.3 ignore (3) term\*_init (4) \fIks\fP term\*_done (4) \fIke\fP .fi .in -2c .LP Notes: .IP (1) \&^\|X means the Control-X character, \*(Ese means escape; see below for an exact description of the format of key definitions. .IP (2) The termcap entries .I "k1 ... k8" describe the codes sent by the function keys, and .I "ku ... kd" decribe the codes sent by the arrow keys. .IP (3) With the name \fIignore\fP you can declare input strings illegal; see below. .IP (4) The termcap entries \fIks\fP and \fIke\fP are sent to the terminal at startup and upon exiting. .LP .ne 3 The third column of the table describes additional bindings for some operations that are derived from termcap, if the termcap entry for your terminal defines that capability. If a termcap definition conflicts with some other default, the definition derived from the termcap holds. (For instance, on a Televideo the left arrow key sends ^\|H; this means that the binding of .I undo to ^\|H (or \*[BACKSPACE\*]) is no longer valid.) .SH KEY DEFINITIONS FILE Each line in the key definitions file contains one definition or a comment. A definition consists of the name of the editing operation (see the table above), an equals sign .RB ( = ), and one or more .I items. Each .I item can be a string, a number, or a control-character. The latter is written as `\|^\|' followed by a letter. A number is an octal number if it starts with 0 (it should not include 8 or 9, then), otherwise it is decimal; it stands for the corresponding ASCII character. Strings are delimited by single .RB ( ' ) or double (\fB"\fP) quotes. Inside strings, the following escape sequences are recognized: .sp \*(.3 .in +0.5i .ta 2c .nf \*(Esddd (one to three octal digits) the ASCII character ddd \*(Esb backspace, 010 \*(Ese escape, 033 \*(Esf formfeed, 014 \*(Esn linefeed, 012 \*(Esr carriage return, 015 \*(Est tab, 011 \*(Es\fIchar\fP any other character (notably \e or ' or ") .fi .in -0.5i .sp \*(.3 Finally, everything from a `#' character to the end of the line is taken as a comment (except inside a string, of course). .LP Each definition implies that the concatenation of its items, when received as input, will provoke the execution of the designated editing operation. A definition for the `operation' .I ignore means that this input string will be treated as an illegal operation (the .I B system will try to ring the bell). .LP Definitions for the .I term\*_init and .I term\*_done operations define strings that will be sent .I to the terminal at initialization time, and on exiting, respectively. These can be used to set programmable function keys, for instance. .LP Note that the definitions in the file only .I add to the already existing key bindings (see the defaults above). When one definition is an initial subsequence of the other, the last one given in the file holds. It is probably counter-productive to have the first item of a definition start with a printable character, as this would make it impossible to enter that character. .LP Beware that you cannot use ^\|] as a key binding when your interrupt character is not the default \*[DEL\*] key; see below. .LP Examples: .LP .in +0.5i .ta 20n .nf widen = "\*(Esep\*(Esr" # HP-2621 function key 1 is escape p return accept = ^\|I # tab undo = ^\|A "O" ^\|M # unshifted function key 11 on Televideo # used because left arrow overwrites ^\|H ignore = 0177 # ignore DEL (a common noise character) .fi .in -0.5i .LP The first of the following four files found by the B system is used to read key bindings from: .LP .in +0.5i .nf $HOME/.Bed\*_$TERM B\*_LIB/.Bed\*_$TERM $HOME/.Bed\*_def B\*_LIB/.Bed\*_def .fi .in -0.5i .LP Here $HOME and $TERM are the values of the environment variables; see sh(1) and tset(1). B\*_LIB stands for a directory appointed by your system administrator (normally /usr/new/lib/B) where various auxiliary files for the .I B system are kept. This organization allows different key bindings per user and per terminal. .SH HELP FILE The file B\*_LIB/Bed\*_help contains a screenful of help information, describing the editing operations and the keys to which they are bound. If you change the key bindings this information is not correct anymore, and so you can define an environment variable BED\*_HELP, that gives the pathname of the file to be printed when the .I help operation is executed. .SH INTERRUPT To interrupt the execution of a .I B command you should normally use the \*[BREAK\*] key. If your interrupt character is the \*[DEL\*] key, this will also work. However, if you have set your interrupt character with .IR stty (1) to something other than \*[DEL\*], the .I B system will in turn reset it to ^\|]. This is done to prevent a collision with a key that accesses one of the .I B editing operations, like ^\|C for copy. It means that you cannot use ^\|] as a key binding in a description file in this case. .SH INVERSE VIDEO (standout mode) If your terminal skips a position on the screen when switching to or from inverse video, you are out of luck. The .I B editor must be able to display part of a word in inverse video and the rest normal, without surrounding spaces in between. You can still use .I B (without the .I B editor) with the command .BR "b -e" ; see .IR b (1). .SH GOTO OPERATION The Goto operation can only be used on terminals that can move the cursor locally, eg. the arrow keys do not send any codes to the host computer. If your terminal can be .I sensed for the cursor position, then you can use the operation to tell it you moved the cursor away. You should ask your system administrator to add the non standard capabilities \fIsp\fP and \fIcp\fP to the termcap entry for your terminal. The \fIsp\fP capability should define the string sent by the .I B system to the terminal to request the cursor position. The \fIcp\fP capability must define the format of the cursor position string as returned by the terminal; most of the % escapes as defined in termcap(5) for cursor addressing are recognized. (For example, .IP cp=\*(EsE&a%r%3c%3Y^\|M:sp=\*(EsE`\*(Es021 .LP are the entries for a HP2621 terminal.) .SH FILES .ta 25n .if n .ta 18n .nf B\*_LIB /usr/new/lib/B, unless changed by your system administrator $HOME/.Bed\*_$TERM key definitions file; first of these four holds B\*_LIB/.Bed\*_$TERM $HOME/.Bed\*_def B\*_LIB/.Bed\*_def $BED\*_HELP file with one screenful of help info B\*_LIB/Bed\*_help default help file .fi .SH BUGS In searching for the key definitions file .Bed\*_$TERM the .I B system doesn't recognize aliases for terminal types. Watch out for variations like e.g. TERM=2621-wl.