For speed this page has been mirrored locally from riceinfo.rice.edu. You may find the original or more up to date versions of this page at original riceinfo site.

Information Technology
  [back to RiceInfo]

1999.5.18

Using the Pico Text Editor


The purpose of this document is to explain the proper usage of Pico, a simple UNIX text editor designed to work with the Pine mail program, or as a standalone editor.

Table of Contents

Introduction

If you use the Pine mailer, Pico will be automatically invoked as your default editor for composing and changing mail messages. You may also run Pico independently by typing pico at your shell prompt. Once running, Pico displays a screen like this:

Parts of Pico

The top line of the Pico screen is a status line. On the left, it shows which version of Pico is currently running. The center of the status line displays the name of the file you are editing; if no files are open, the words "New Buffer" are displayed. A message ("Modified") will appear to the right of the file name to indicate outstanding modifications, or modifications that have not yet been saved.

The message bar, three lines from the bottom, is used to report informational messages and to prompt the user for additional input to commands such as Search, Read, and Write. The two lines below that display all the editing commands available from your current context. Get Help [^G or (F1)] is always a choice. Pico's Help is context-sensitive; that is, Help will give you the information most relevant to your current situation.

Ins and Outs of Pico

To open a file for editing, choose the Read File [^R or (F5)] command from the top-level menu. Type in a file name at the prompt, or use To Files (^T) to access the file browser. A more complete explanation of the capabilities of the file browser is available in the section File Browsing with Pico below.

The file browser displays a directory listing for your current directory. Use the normal commands for changing cursor position (see section Traveling Through Pico) to highlight the file or directory you wish to open. You may also use Goto Dir (G) to change directories. Press Select (S) or ENTER when you have highlighted the correct file. The text of that file will appear in Pico's editing buffer on the main screen. Any character you type that is not part of a command sequence will be printed into this buffer automatically.

When you have finished editing a file, choose Write Out [^O or (F3)] to write the contents of the editing buffer to a file. Again, you will be prompted for a file name. Choosing To Files (^T) will reopen the file browser you saw earlier. If you exit Pico with ^X [or (F2)], the message bar will automatically give you the option to write out before exiting. If Pico is interrupted while running, the information in the editing buffer will be saved under the current file name, with .save appended. If the current work is unnamed, it will be saved as pico.save.

Traveling Through Pico

Pico is largely based on MicroEmacs 3.6. It uses the same commands for changing cursor position as other Gnuemacs derivatives. Pico also offers the ^C [or (F11)] Report Cursor Position feature at the editing buffer. Invoking this command will display the cursor's location (line and character) in the message bar. A table of basic navigational commands is listed below:

Table 1.


KEY SEQUENCE RESULTANT ACTION --------------------------------------- ^F forward one space ^B back one space ^P previous line ^N next line ^A beginning of line ^E end of line ^V (F8) forward one page ^Y (F7) back one page

Editing Features Available in Pico

Inserting and Deleting

The default mode for Pico is an insert mode. Unless otherwise specified, any text you type will be inserted into the editing buffer. To insert a tab, use ^I or the TAB key. To delete one character at the cursor, the command is ^D. (You may also use the Delete key on your keyboard to delete the character immediately to the right of the cursor.) ^K [or (F9)] kills the current line. To restore text, ^U [or (F10)] undeletes the last killed line.

Searching and Spelling

Pico has only one kind of search: a non-incremental, case-insensitive, forward search. The command is ^W [or (F6)], for Where Is?. When you enter ^W, the message bar will prompt you for a search string. The cursor is placed on the first character of the search string when it is found. The most recently entered search string will serve as a default string the next time you invoke Where Is?. This search is one-directional, but it wraps around so that the entire document is searched. When the search wraps, a message "Search wrapped" will be displayed on the message bar.

The command To Spell [^T or (F12) at the editing buffer] will examine each word in the document. A misspelled word will be highlighted in the editing buffer while the message bar offers alternatives and prompts for replacement. Cancel the spelling check at any time by using ^C. You may change the spellcheck routine used by Pico by setting the SPELL environment variable. Alternative routines should read stdin (standard input, default is the keyboard) and write to stdout (standard output, default is the screen). The capacity of the default routine is limited, so it may be worth the trouble to do this.

Paragraph Formatting

Choose ^J to justify (or format) the paragraph in which your cursor is currently located. If the cursor is on a blank line, the paragraph beginning immediately below will be affected. Paragraphs are delimited by preceding blank lines, or by initial tabs or spaces. Once a paragraph is justified, the ^U command becomes Unjustify, in case you change your mind.

File Browsing in Pico

You may access the Pico file browser through Read File or Write Out, as discussed above. In addition to opening files for input and output, the file browser also allows you to make some simple alterations to the contents of your directories. Use D to delete a file, R to rename, and M to copy. The - command moves to the previous page of the directory listing, and the Space bar moves one page forward. You may also perform a Where Is? (^W) search in the directory listing. To cancel file browser mode, press C.

Other Features

Pico has several features that can be modified or activated at startup. The most useful are listed below:

-f
enables you to use the function keys to invoke commands; in the preceding sections, these keys are written in parentheses [ex: (F8)] next to their corresponding commands.
+n
where n is a numeric argument; start Pico n lines into the document.
-nn
checks for new mail every n seconds; minimum is 30 seconds, default is 180.
-t
tool mode; used when Pico is running inside another program such as Pine or Pnews; no save prompt upon exit, no buffer renaming for Write Out.
-v
opens a document for viewing only.
-w
disables word wrap for editing long lines.
-z
enables ^Z suspension of Pico.
Type in any or many of these flags after typing Pico at the shell prompt. To open a specific file in Pico from startup, type the filename after any flags you may have used.

Questions or Problems?

Try Get Help (^G) in Pico first. If you don't find what you are looking for, ask at the Consulting Center, located in 103 Mudd Lab. If it is not convenient for you to visit the Consulting Center, call 713-527-4983, connect to http://problem.rice.edu, or send a question via electronic mail to problem@rice.edu for assistance.

<-- Back to INFORMATION TECHNOLOGY

[back to RiceInfo]


--User Services Publications Team (pubteam@rice.edu) 1999.5.18