Computing &
Information Services

 

Using the Pico Text Editor in the Unix Environment



Introduction


The Pico screen editor accompanies the Pine electronic mail program that is available on the CIS UNIX Timesharing Services, as well as most UNIX-based workstations in the campus computing labs. However, you do not have to go into Pine in order to use the Pico editor. Pico will work from any operating shell. The Pico editor's simplicity is one of its most attractive features for the novice user. However, some of its limitations may cause the more experienced UNIX users to look to Emacs or vi for more advanced editing functions

Pico is only available in the UNIX environment. Although it is simple, it is not similar to any text editors available on the VMS Timesharing Service. If you will be working extensively on both VMS and UNIX, then you will probably want to learn the Emacs editor since it is available in both environments. Detailed information on Emacs is available in the CIS document Overview of Text Editors on VMS and UNIX. For assistance using the UNIX Timesharing Service, see the document Basic UNIX Commands.

<-Back to the Top


Starting Pico

To edit a pre-existing file with the Pico editor, type "pico" followed by the name of the file at a UNIX system prompt:

$ (1) unixs $ pico sample.file

To create a new file, enter "pico" followed by the name that you want the new file to have:

$ (1) unixs $ pico new.file

  <-Back to the Top


The Pico Display

The Pico screen display has a specific format. It uses the top line of the screen for displaying the file name and its status; this line is always in reverse video (black, with white type). The second line of the display is not used. The 23rd and 24th lines of the display (the bottom two lines) are used to display the keystrokes that are available to perform certain editing functions. The majority of lines, lines 3 through 21, are used for the display and editing of the actual text of the file.

Line 22 of the display is directly above the two lines of keystroke options. This line is used to display information and to prompt instructions. Messages and prompts are always in reverse video. Messages in line 22 remain for a length of time (even if they are no longer valid) or until a new message or prompt is displayed that replaces it. For example, if you invoke a keystroke commands that results in a prompt on line22, but then hit the "Cancel" keystroke command, the prompt will remain. This does not mean that the original commmand was not canceled. Just continue editing your file, or press Control-L (^L) to redraw the display without the prompt on Line 22.

The bottom two lines of the display use the caret (^) character to symbolize holding the Control key in order to use the listed key. For example the ^G symbol means that you hold down the Control key and then type a "G" in order to bring up the Pico Help screen. It is necessary to press the Control key so that Pico can tell the difference between a function keystroke and actual characters that are to be written into the file being edited. Although the keystroke options display capital letters, it is not necessary to press the Shift key - you may enter lower case letters for all commands.

The Pico screen cursor will always appear on line #3 (the first line of the file's text) at the far left when a file is just opened. Pico will insert text at the position in the file that the cursor indicates. Once you begin typing, the cursor will move with the text. The cursor in Pico is the same as the cursor in Pine and at the Unix prompt - a black rectangle.

  <-Back to the Top


Moving Around in the Pico Screen Display

Once you have entered several lines of text, you can use the arrow keys on your keypad to move the cursor up, down, left and right through the lines of the display. If your directional arrow keys are not working or not available, you can use the following keystrokes to move around in the text:

Control+B (^B) Moves the cursor back one character (to the left).
Control+F (^F) Moves the cursor forward one character (to the right).
Control+P (^P) Moves the cursor to the previous line of the display (up).
Control+N (^N) Moves the cursor to the next line of the display (down).

To move ahead in the text by one full screen, press Control+V (^V). To move back in the text one full screen, press Control+Y (^Y).

  <-Back to the Top


Inserting Text

If you have a file saved on your directory that you want to include in the file you are editing, press Control+R. Pico will prompt you for the file name on line 22 of the display.

File to be inserted from (default directory):

Enter the file name and Pico will write the text of the outside file into the current file's text at the cursor position. If the outside file is not on your default disk directory, you will have to enter the full address of the file in order for Pico to find the file.

While you are at the "File to be inserted:" prompt, you can press Control+T to bring up the Pine Browser utility that will let you select the file to be inserted or change the directory that is being viewed. Use the keypad arrow keys to highlight the available files/directories.
 

  <-Back to the Top


Other Useful Pico Editing Functions

The following list details some of the other keystroke functions available in the main screen of the Pico editor. Some of these are listed on the bottom two lines of the Pico display, while some are not.
 
Control+C (^C) Displays the current cursor position on line 22.
Control+D (^D) Deletes one character to the left.
Control+E (^E) Moves the cursor to the end of the line.
Control+I (^I) Inserts one tab character.
Control+J (^J) Justifies the paragraph set off by blank lines
Control+K (^K) Deletes the entire line where the cursor is positioned.
Control+L (^L) Re-draws the display to remove system messages.
Control+M (^M) Inserts a carriage return.
Control+0 (^0) Save/Save As another file name.
Control+T (^T) Invokes the Pico spell checker 
If Pico finds a misspelled word, it will display the "Edit a replacement: (misspelled word)" prompt. To change the spelling, edit the word in line 22; to keep it as is, press Enter or Return.
Control+U (^U) Re-writes (uncuts) a recently deleted line
Control+W (^W) Searches the text for a specified string of characters. 
You will be prompted for the word/string of characters that Pico is to find. The cursor will then move to the first instance of the word/string for which you searched.
Control+X (^X) Exits the Pico editor. It will also prompt to save.
 
<-Back to the Top




Saving and Exiting from Pico

If you want to save your file while you continue to work on it, use the Control+O keystroke. Pico will automatically prompt: "File Name to write:" followed by the name of the file. Just press Return to save the file and the Pico display will return. Pico does not feature an automatic backup feature like the EMACS or vi editors.

To save and exit, press Control+X. If you have changed anything about the file during your Pico session, the program will prompt: "Modified buffer: Save before leaving (y/n)?" If you press "N" at this point, the UNIX system prompt will return and the file will not be saved. If you press "Y" at this point, then Pico will prompt: "File name to write:" followed by the name of the file. Press Return to save the file and return to the UNIX system prompt.

You can also rename the file by editing the file name that is provided on the "File name to write:" prompt line (or by deleting it altogether and entering a new name). This is similar to the "Save As" command in MS Word or WordPerfect in that it will save the edited file under the new name, while retaining a copy of the file under its original name at the time of its last save.

  <-Back to the Top


Getting Help
 

On-line Help

Press Control+G to bring up the Pico on-line help file. It features a brief outline of keystroke commands, similar to the listing here. You can use the Control+V and Control+Y keystrokes to scroll back and forth through the text of the help entry. To exit from the help screen and return to your file, press Control+X.
 

Getting Additional Help

Enter "man pico" at the UNIX system prompt for more on-line help on the Pico text editor. Press Enter or Return to scroll through this file one line at a time, or the Space Bar to move through it screen by screen. When you have reached the end of the help file, it will return you to the Unix prompt. To return to the Unix prompt before you reach the end, press Control+C (^C).

If you are still new to the entire UNIX system, you may find the Help Sheet Basic UNIX Commands helpful. Also, consultants are on duty in all campus computing labs during their operating hours; please feel free to approach a Consultant for assistance.

For more detailed questions about UNIX and /or Pico, contact the Help Desk. They can be reached by:

<-Back to the Top


This help sheet is available in Postscript via Pitt's FTP server at /afs/pitt.edu/public/info/pittdoc under the filename pico.ps as well as in PDF form.
End of file:  pico.html
REF #: UNX-9601-02.1