TECO(1)

NAME
teco - The grand old text editor

SYNOPSIS
tecoc make [-noini] [-nomemory] file
tecoc teco [-inspect] [-nocreate] [-noini] [-nomemory] [-nopage] [-norename] [+nnn] file
tecoc mung [-noini] file

DESCRIPTION
This description section is sufficiently long that it has been split into a number of subsections.

  Command names
teco is actually invoked by the command tecoc. It takes a first argument of make, teco, or mung to control its operating mode. In the FreeBSD version, the base name of the invoking command is tested to provide this first argument. For ease of use, it is recommended that aliases are set up. The recommended (and usual) mappings are:

Make
    to tecoc make (note the uppercase first letter to avoid confusion with make(1))

teco
    to tecoc teco

mung
    to tecoc mung

inspect
    to tecoc teco -inspect

These mappings are assumed in the Options and Command invocations sections below.

  Options
Options may be abbreviated; for each option, the part shown in brackets can be omitted. The following options are available for the teco command:

-in[spect]
    read the file only, don't create an output file.

-noc[reate]
    if the file doesn't exist, don't create it.

-noi[ni]
    don't execute the initialisation file. This is valid for Make or mung as well.

-nom[emory]
    don't remember the filename (see Filename memory below). This is valid for Make also.

-nop[age]
    don't separate input into pages. Instead, treat form feeds as normal characters.

-nor[ename]
    don't rename files, but copy them to keep references correct

+nnn
    where nnn is any number of digits. Go to line number nnn and set -nopage.

  Command invocations

There are a number of different ways of starting teco.

Make file
    starts teco to create file.
    This is equivalent to EWfile$$

teco file
    starts teco to edit file.
    This is equivalent to EBfile$Y$$

teco file2=file1
    starts teco to edit file1, writing to file2.
    This is equivalent to ERfile1$EWfile2$Y$$

teco
    starts teco to edit the last edited file. By default, the name of that file is saved in a file named tecoN.tmp in the current directory, where N is the process ID of the parent process to teco. This can be overridden, as described in Filename memory below.

mung file args
    starts teco to execute file.
    This is equivalent to I<args>$JEIfile$$
    Instead of mung, the command teco @file args can be used.

  Key Bindings
The keys mentioned in the teco.doc file are somewhat confusing. This should help:

<DELIM>
    The Esc echoes as $, however the teco.doc file shows it as `.

<BS>
    Type as Control-H; this isn't the Backspace key.

<DELETE>
    The Backspace key; this isn't the Delete key.

<CR>
    The Enter key.

<LF>
    Type as Control-J.

Note that the assignments for <BS> and <DELETE> shown here are swapped. <BS> can be Backspace and <DELETE> can be Control-H by clearing ET&2048, e.g. 2048,0ET

  Initialisation file
teco mungs (executes as teco commands) the file TECO.INI (yes, in uppercase) in the current directory before processing the command line. Initialisation can be done instead by defining an environment variable named TEC_INIT. The value is either the list of teco commands to execute, or a $ followed by the pathname of the initialisation file. This allows a single, centrally located initialisation file. Remember that the $ must be escaped with a backslash character.

The initialisation file can be used to make initial settings. It can return a value, but the value setting is somewhat obscure.

For example, the following will both cause successful searches to auto-display in all teco sessions.

Example (csh):
    setenv TEC_INIT 1es
Example (bash):
    TEC_INIT=1es
    export TEC_INIT

The following will each cause the file ~/.tecrc to be used as the initialisation file.
Example (csh):
    setenv TEC_INIT \$~/.tecrc
Example (bash):
    TEC_INIT=\$~/.tecrc
    export TEC_INIT

  Filename memory
teco tries to remember the last file that it edited, so that after a file has been edited once, it can be re-edited without the file name having to be repeated on the command line. teco implements this by writing and reading a file that contains the name of the last file edited. By default, the file name is tecoN.tmp in the current directory, where N is the process ID of the parent process to teco.

To change the location of the memory file, define the environment variable TEC_MEMORY to be $ followed by the pathname of the file to be designated as the memory file. Remember that the $ must be escaped with a backslash character.

The following examples will cause the name of the last file edited to be stored in the file teco.mem in the home directory.

Example (csh):
    setenv TEC_MEMORY \$~/teco.mem
Example (bash):
    TEC_MEMORY=\$~/teco.mem
    export TEC_MEMORY

  Library directory
The environment variable TEC_LIBRARY can be set to be a directory path (including the final /); the path must be preceded by a $ character. This allows the EI command to fetch teco commands from this directory if the file is not found in the current directory. Remember that the $ must be escaped with a backslash character.

Example (csh):
    setenv TEC_LIBRARY \$%%PREFIX%%/lib/
Example (bash):
    TEC_LIBRARY=\$/usr/%%PREFIX%%/lib/
    export TEC_LIBRARY

This will cause the directory %%PREFIX%%/lib to be searched for teco command files.

  Implemented flags
There are a number of flags that can be set inside teco, using the ED and ET mode control commands. To add functionality, teco is also sensitive to bits in an extra mode control flag, EZ. Bits in the EZ mode control command are used in different ways by different operating systems; only those relevant to FreeBSD are described here.

ED&1
    Allow the caret ^ character in string searches.
ED&2
    Allow yank and _ unconditionally.
ED&16
    Failed searches preserve dot.
ED&64
    Move dot by one after each match in multiple occurrence searches.

ET&1
    Type out in image mode.
ET&2
    Use scope for delete and Control-U (default=1)
ET&4
    Accept lowercase input (default=1).
ET&8
    Control-T reads without echo.
ET&32
    Control-T reads with no wait.
ET&128
    mung mode (abort on error); cleared by * prompt.
ET&2048
    Swap backspace and delete.
ET&4096
    We are using 8 bit characters (default=1).
ET&32768
    Trap Control-C.

EZ&128
    If set, don't stop on form feeds when reading. If clear, a form feed in the input stream stops the read (the standard teco style). This bit is off by default.
EZ&256
    If set, use UNIX-style newline terminators. This means when files are read in, carriage-returns are not added to the end of lines, and when the user types the RETURN key, only a newline is entered into the command line (usually a carriage-return/line-feed pair is entered). Old macros (and old teco users) may get confused if this bit is set.
EZ&16384
    Normally, the backup file name is created by replacing the file extension with .bak - foo.c becomes foo.bak; however, if this bit is set then the backup file name is created by simply adding .bak to the name - foo.c becomes foo.c.bak. This choice is overridden by EZ&1 = 0.

ENVIRONMENT
The following environment variables are used by teco:

TECO_INIT
    The value of this variable can be either a teco command string, or the name of a file containing teco commands. The filename must be preceded by a $ character. Remember that the $ must be escaped with a backslash character. See also Initialisation file.

TECO_LIBRARY
    The value of this variable should be a path to the directory that contains files of teco commands, to be accessed using XX. The pathname should include the trailing /. Remember that the $ must be escaped with a backslash character. See also Library directory.

TECO_MEMORY
    The value of this variable should be the name of a file To be used for remembereing the name of the last file edited by teco. The filename must be preceded by a $ character. Remember that the $ must be escaped with a backslash character. See also Filename memory.

FILES

%%DATADIR%%/*
    Miscellaneous teco macros and commands.

%%DOCSDIR%%/teco.doc
    The teco manual (if installed).

%%DOCSDIR%%/wchart.txt
    Summary of teco keystrokes (if installed).

EXIT STATUS

SEE ALSO
A variety of documentation files may be installed in %%DOCSDIR%%. Apart from the ones mentioned in the FILES section, they are of limited use, because they refer to slightly different versions of teco.

There are also many online resources.

AUTHORS
Pete Siemsen <siemsen@usc.edu>.
Tom Almy <tomalmy@aracnet.com>.
FreeBSD port and manual page maintained by Bob Eager <bob@eager.cx>.

BUGS
There is no video mode.