You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

233 lines
6.9 KiB

<h1>Survival TECO</h1>
<p>Below is a subset of commands for minimal useful editing
with TECO, the venerable command-based, character-oriented
text editor.</p>
<ul>
<li>Commands are executed by following them with the key
sequence <strong>Esc&nbsp;Esc</strong> instead of <strong>Enter</strong>. An arbitrarily long sequence of commands can be entered and executed together.</li>
<li>TECO doesn't file name arguments passed on the command line. Instead, after starting TECO you have to specify the input and/or output file with the commands <strong>ER</strong>, <strong>EW</strong>, or <strong>EB</strong>, then read the input file into the edit buffer with the command <strong>Y</strong>.</li>
<li>TECO considers files containing form-feed characters (ASCII 0x0b, <strong>^L</strong>) to be composed of multiple pages with each page consisting of the text between form-feed characters or the beginning or end of the file. TECO will only read into the buffer and edit one page at a time. To edit a multi-page file, complete editing on the first page then use the <strong>P</strong> command to save the page to the output file, reinitialize the buffer, and read the next page from the input file.
Once a page has been saved with the <strong>P</strong> command, it may not be revisited except by saving the entire file and restarting the editing process from the beginning.
Repeat the process until all necessary pages have been edited. The <strong>EX</strong> command automatically copies any unedited pages in the input file to the output file before exiting.
</li>
</li>
</ul>
<table border=1>
<tr>
<tr>
<th colspan=2>File I/O and Termination</th>
</tr>
<tr>
<td>EB<em>file</em><strong>Esc</strong></td>
<td>Open <em>file</em> for <strong>B</strong>oth input and output</td>
</tr>
<tr>
<td>ER<em>file</em><strong>Esc</strong></td>
<td>Open <em>file</em> for <strong>R</strong>ead-only (input)</td>
</tr>
<tr>
<td>EW<em>file</em><strong>Esc</strong></td>
<td>Open <em>file</em> for <strong>W</strong>rite-only (output)</td>
</tr>
<tr>
<td>Y</td>
<td>Initialize buffer and read from input file (one page)</td>
</tr>
<tr>
<td>P</td>
<td>Append buffer to output file, reinitialize buffer, read next <strong>P</strong>age from input file</td>
</tr>
<tr>
<td>EX</td>
<td>Write buffer to output file and <strong>EX</strong>it</td>
</tr>
<tr>
<td><strong>^C&nbsp;^C</strong></td>
<td>Abandon buffer changes and exit</td>
</tr>
<tr>
<th colspan=2>Movement</th>
</tr>
<tr>
<td>[<em>n</em>]C</td>
<td>Move one/<em>n</em> <strong>C</strong>haracter(s) forward</td>
</tr>
<tr>
<td>-[<em>n</em>]C<br>[<em>n</em>]R</td>
<td>Move one/<em>n</em> <strong>C</strong>haracter(s) backward (<strong>R</strong>everse)</td>
</tr>
<tr>
<td>[<em>n</em>]L</td>
<td>Move to beginning of first/<em>n</em>th following <strong>L</strong>ine</td>
</tr>
<tr>
<td>-[<em>n</em>]L</td>
<td>Move to beginning of first/<em>n</em>th preceding <strong>L</strong>ine</td>
</tr>
<tr>
<td>0L</td>
<td>Move to beginning of current line</td>
</tr>
<tr>
<td>:L</td>
<td>Move to end of current <strong>L</strong>ine</td>
</tr>
<tr>
<td>[<em>n</em>]J</td>
<td><strong>J</strong>ump to first/<em>n</em>+1 character in buffer</td>
</tr>
<tr>
<td>ZJ</td>
<td><strong>J</strong>ump to end of buffer</td>
</tr>
<tr>
<th colspan=2>Display</th>
</tr>
<tr>
<td>[<em>n</em>]T</td>
<td><strong>T</strong>ype from current position to end of current/<em>n</em>-1 following line(s)</td>
</tr>
<tr>
<td>0T</td>
<td><strong>T</strong>ype from beginning of line to curent position</td>
</tr>
<tr>
<td>-[<em>n</em>]T</td>
<td><strong>T</strong>ype one/<em>n</em> preceding line(s) and current line up to position</td>
</tr>
<tr>
<td>HT</td>
<td><strong>T</strong>ype whole buffer</td>
</tr>
<tr>
<th colspan=2>Useful Combinations</th>
</tr>
<tr>
<td>0TT</td>
<td>Type current line (current position unchanged)</td>
</tr>
<tr>
<td>0LT</td>
<td>Type current line, moving position to beginning of line</td>
</tr>
<tr>
<th colspan=2>Insertion</th>
</tr>
<tr>
<td>I<em>text</em><strong>Esc</strong></td>
<td><strong>I</strong>nsert <em>text</em> at current position</td>
</tr>
<tr>
<th colspan=2>Deletion</th>
</tr>
<tr>
<td>[<em>n</em>]D</td>
<td><strong>D</strong>elete one/<em>n</em> character(s) after position</td>
</tr>
<tr>
<td>-[<em>n</em>]D</td>
<td><strong>D</strong>elete one/<em>n</em> character(s) before position</td>
</tr>
<tr>
<td>[<em>n</em>]K</td>
<td>Delete from position through end of current/<em>n</em>-1 following line(s)</td>
</tr>
<tr>
<td>-[<em>n</em>]K</td>
<td>Delete one/<em>n</em> preceding lines to current position</td>
</tr>
<tr>
<td>0K</td>
<td>Delete from beginning of current line to position</td>
</tr>
<tr>
<td>:K</td>
<td>Delete from position to end of current line leaving end-of-line</td>
</tr>
<tr>
<td>HK</td>
<td>Delete whole buffer</td>
</tr>
<tr>
<th colspan=2>Search/Replace</th>
</tr>
<tr>
<td>[<em>n</em>]S<em>text</em><strong>Esc</strong></td>
<td><strong>S</strong>earch for next/<em>n</em>th occurrence of <em>text</em></td>
</tr>
<tr>
<td>[<em>n</em>]FS<em>text1</em><strong>Esc</strong><em>text2</em><strong>Esc</strong></td>
<td>Replace next/<em>n</em>th occurrence of <em>text1</em> with <em>text2</em></td>
</tr>
<tr>
<th colspan=2>Copy/Paste</th>
</tr>
<tr>
<td>[<em>n</em>]X<em>q</em></td>
<td>Copy from position through end of current/<em>n</em>-1 following line(s) to register <em>q</em> (single character A-Z, 0-9)</td>
</tr>
<tr>
<td>G<em>q</em></td>
<td>Insert text in register <em>q</em> into buffer at current position</td>
</tr>
</table>
<h2>References</h2>
<ul>
<li><a href="http://www.avanthar.com/~healyzh/_info_/its.primer">Golden, V. Ellen. An Introduction to ITS for the MACSYMA User. Massachusetts Institute of Technology Laboratory for Computer Science Mathlab Group. 14 April 1981. &lt;http://www.avanthar.com/~healyzh/_info_/its.primer&gt; accessed 4 June 2010.</a></li>
<li><a href="http://www.avanthar.com/~healyzh/teco/TecoPocketGuide.html">TECO Pocket Guide. Digital Equipment Corporation. 1978. &lt;http://www.avanthar.com/~healyzh/teco/TecoPocketGuide.html&gt; accessed 4 June 2010.</a></li>
<li><a href="http://www.hactrn.net/sra/alice/alices.pdp10">You can hack anything you want, with TECO and DDT.</a></li>
</ul>
<hr>
<table style="background: black; color: green; border: 1px solid green; border-collapse: collapse;">
<tr><td style="border: 1px solid green;">Edited with</td><td style="background: green; color: black; border: 1px solid green;"><strong>TECO</strong></td></tr>
</table>
$Id: survival-teco.html,v 1.4 2010/06/12 09:44:01 papa Exp $