Operating System User's Guide
Chapter 1, Using SCO Shell

Editing a file

Editing a file

You can edit the contents of a text file using the Edit option in the Manager menu. When you select Edit, a listing of the files in your current directory appears, as explained in the section, ``Looking at a file''.

Select the file(s) that you want to edit. Once you select a file, the first screen of text appears.


Editing commands

To edit a text file, use the Edit Mode commands available for editing text in form fields. The following table gives a brief introduction to the editing commands.

 ---------------------------------------------------------------------
 Command            Description
 ---------------------------------------------------------------------
 Arrow keys         Moves the cursor up and down through the file, and
                    to the right or left on each line.
 <PgUp> or <PgDn>   Use <PgUp> to jump back to the previous page, or
                    <PgDn> to jump forward to the next page.  A
                    ``page'' is one screen of lines.
 <Home>             Moves the cursor to the beginning of the current
                    line.
 <End>              Moves the cursor to the end of the current line.
 <Esc>              Switches between editing the file and using the
                    Edit menu.
 <Ctrl>G           Moves to the top of the document.
 <Ctrl>G           Moves to the bottom of the document.
 <Ctrl>N            Moves the cursor to the next word.
 <Ctrl>P            Moves the cursor to the previous word.
 <Ctrl>W            Deletes the word the cursor is on, if the cursor
                    is on the first character of the word.
 <Ctrl>Y            Deletes the current line (the line the cursor is
                    on).
 <F8>               Pastes a deleted line back into the file.  The
                    Edit program stores the last 10 lines you deleted.
                    When you press <F8>, the last line you deleted
                    reappears.  If you press <F8> again, the next to
                    last line you deleted reappears, and so on.
 <Ctrl>O            Inserts a blank line above the current line.
 <Ctrl>V            Switches between Insert and Overstrike mode.  You
                    are in Insert mode to start.  If you move the
                    cursor to some existing text and begin typing, the
                    new words are inserted between the existing words.
                    If you press <Ctrl>V to change to Overstrike mode,
                    the words you type replace (overstrike) any
                    existing words on the same line.  Press <Ctrl>V 
                    again to return to Insert mode.
 <Ctrl>Z            Calls up the pop-up list of extra file-editing and
                    formatting options.  This is the same as pressing
                    <F9>.
 <F5>               Prompts you to enter a word, then searches for the
                    next occurrence of that word in your file.


Pop-up list of extra edit-mode commands

When you press <F9> in Edit mode, a list of extra editing commands appears on the screen, like this:

To choose a command from this list, position the highlight bar over the command that you want and press <Enter>. To use the Format Paragraph, Delete Line, and Join Lines commands, you must position the cursor on the line or paragraph that you want before pressing <F9>.

The following table describes the commands on the Extra Commands list:

 -----------------------------------------------------------------------
 Command                  Description
 -----------------------------------------------------------------------
 Format Paragraph         Reformats the paragraph that the cursor is on.
                          This command fills each line with text out to
                          the margin, moving text up from subsequent
                          lines as necessary.
 Join Lines               Joins the line the cursor is on with the text
                          of the next line.  If both lines together are
                          too long to fit within the file margin, only
                          part of the text from the second line is
                          joined to the first.
 Margin (set)             Resets the line length for this file.  The
                          default line length appears in a box.  Type in
                          the new line length and press <Enter>.  If you
                          type in new text now, the text automatically
                          breaks to a new line after reaching the line
                          length that you set.  To reformat existing
                          paragraphs to the new line length, use the
                          Format Paragraph command.  To reset the
                          default line length for all editing, use the
                          Preferences command in the Manager Menu.
 Delete Line (^y)         Deletes the line that the cursor is on.  This
                          option is the same as pressing <Ctrl>Y.
 Paste (undelete, <F8>)   Pastes deleted lines back into the file.  When
                          you choose Paste, the last line that you
                          deleted reappears.  If you choose Paste again,
                          the next to last line that you deleted
                          reappears, and so on, up to a maximum of 10
                          lines.  Choosing Paste is the same as pressing
                          <F8>.
From within the editor, other functions are available; to use these other functions, press <Esc> while editing a file. The Edit menu appears, with the following options:

The options in the menu are described briefly in the following table:

 ---------------------------------------------------------------------
 Option       Description
 ---------------------------------------------------------------------
 Edit         invokes the Auto Editor
 Include      includes a file in the current document
 Transfer     moves items to and from the Clipboard, and deletes items
              from the Clipboard
 Quit         optionally saves your work, exits the editor, and
              returns to the Manager menu
If you choose the Edit option, the text of the file appears, and you can edit it using the Auto Editor. When you access the editor, you will, by default, use a built-in editor; however should you wish to use a different editor, you can configure your system so that you can use your own favorite editor. This is known as the Auto Editor; you can choose an Auto Editor by selecting: Manager Preferences .

Select the Include option to include another file in the file that you are currently editing. When you select Include, a pop-up window appears listing the files in the current directory. Use the cursor movement commands to select a file. The file is inserted after the cursor position.

The Transfer option allows you to access the Clipboard while you are editing a file. You can use the Clipboard to transfer text and other forms of data between different applications. See ``Using the clipboard from the Manager menu'' for more information about using the Clipboard.

The Quit option exits the Edit Mode and returns you to the Manager menu. Quit also saves your latest changes to the current file.