The financial support of an IBM Graduate Fellowship and the National Science Foundation under grants MCS74-07644-A03 and MCS78-07291 is gratefully acknowledged.
If you gave the system an incorrect terminal type code then the editor may have just made a mess out of your screen. This happens when it sends control codes for one kind of terminal to some other kind of terminal. n this case hit the keys :q (colon and the q key) and then hit the RETURN key. This should get you back to the command level interpreter. Figure out what you did wrong (ask someone else if necessary) and try again.
Another thing which can go wrong is that you typed the wrong file name and the editor just printed an error diagnostic. In this case you should follow the above procedure for getting out of the editor, and try again this time spelling the file name correctly.
If the editor doesn't seem to respond to the commands which you type here, try sending an interrupt to it by hitting the DEL or RUB key on your terminal, and then hitting the :q command again followed by a carriage return.
As we will see later, h moves back to the left (like control-h which is a backspace), j moves down (in the same column), k moves up (in the same column), and l moves to the right.
On smart terminals where it is possible, the editor will quietly flash the screen rather than ringing the bell.
Backspacing over the '/' will also cancel the search.
Note: If the editor prints No previous regular expression on the bottom line of the screen, the DEL key on your terminal does not send the delete character ^?, but a character sequence starting with ESC. The interrupt function is most often assigned to ^C then (refer to section 2.1 about the notation). If you cannot find the appropriate key or key sequence, type
% stty -a
at the shell command level and look for the characters following intr.
On some systems, this interruptibility comes at a price: you cannot type ahead when the editor is computing with the cursor on the bottom line.
All commands which read from the last display line can also be terminated with a ESC as well as an CR.
If you don't have a '^' key on your terminal then there is probably a key labelled '↑'; in any case these characters are one and the same. Note: Some web browsers are unable to display an uparrow character and show ↑ instead. Read this as uparrow. Be aware that the uparrow mentioned here is not one of the keys on the cursor keypad, but an ancient notation for the caret or circumflex character.
These searches will normally wrap around the end of the file, and thus find the string even if it is not on a line in the direction you search provided it is anywhere else in the file. You can disable this wraparound in scans by giving the command :se nowrapscanCR, or more briefly :se nowsCR.
Actually, the string you give to search for here can be a regular expression in the sense of the editors ex(1) and ed(1). If you don't wish to learn about this yet, you can disable this more general facility by doing :se nomagicCR; by putting this command in EXINIT in your environment, you can have this always be in effect (more about EXINIT later.)
In fact, the character ^H (backspace) always works to erase the last input character here, regardless of what your erase character is.
The command S is a convenient synonym for for cc, by analogy with s. Think of S as a substitute on lines, while s is a substitute on characters.
One subtle point here involves using the / search after a d. This will normally delete characters from the current position to the point of the match. If what is desired is to delete whole lines including the two points, give the pattern as /pat/+0, a line address.
This is settable by a command of the form :se ts=xCR, where x is 4 to set tabstops every four columns. This has effect on the screen representation within the editor.
The [[ and ]] operations require the operation character to be doubled because they can move the cursor far from where it currently is. While it is easy to get back with the command ``, these commands would still be frustrating if they were easy to hit accidentally.
You can easily change or extend this set of macros by assigning a different string to the paragraphs option in your EXINIT. See section 6.2 for details. The '.bp' directive is also considered to start a paragraph.
Note that the command 5z. has an entirely different effect, placing line 5 in the center of a new window.
All commands which start with : are ex commands.
In rare cases, some of the lines of the file may be lost. The editor will give you the numbers of these lines and the text of the lines will be replaced by the string 'LOST'. These lines will almost always be among the last few which you changed. You can either choose to discard the changes which you made (if they are easy to remake) or to replace the few lost lines by hand.
You can make long lines very easily by using J to join together short lines.
But not by a ^L which just redraws the screen as it is.
This is not quite true. The implementation of the editor does not allow the NULL (^@) character to appear in files. Also the LF (linefeed or ^J) character is used by the editor to separate lines in the file, so it cannot appear in the middle of a line. You can insert any other character, however, if you wait for the editor to echo the ↑ before you type the character. In fact, the editor will treat a following letter as a request for the corresponding control character. This is the only way to type ^S or ^Q, since the system normally uses them to suspend and resume output and never gives them to the editor to process.
The \ character you give will not echo until you type another key.
Table of Contents