Pico Text Editor for UNIX


Conventions Used in this Solution: The word "current," when used in reference to some unit of text, refers to where the cursor is--e.g. current position, line, word or character. This document also uses different font styles to clarify the meaning of the text.

Bold Courier text: Indicates words or characters you must type in

Italic text: Used as a general word or phrase for which you must substitute a specific example (e.g. for file name you might

substitute myfile)

Bold text: Used for section headers and to signal buttons or parts of the interface that you will interact with.

Starting Pico

To edit a file with pico, type any of the following at the UNIX system prompt:

pico

 creates a new, unnamed file 

pico filename

 allows you to edit an existing file or create a new file named filename

pico -v   filename

 opens filename to view only; no editing allowed

Note: Pico, unlike UNIX, is not case-sensitive; it does not make a difference whether commands are typed in upper or lower case.

When you enter pico, a window display will appear, as illustrated below:

Pico window display

The Pico window display is divided into four main areas: Status Line, File Content, Message Line, and Command List.

Status Line

The Status Line shows Pico's version number, the current file being edited, and information pertinent to the status of the file (or text) during your edit session.

File Content

The File Content area is used to enter the text for the file you are creating or modifying. When you enter text in this area, you don't need to press Enter at the end of the line. Pico has a word wrap feature, similar to a word processor. When you approach the end of a line, and the word you are typing goes beyond P

Pico's right margin, that word will automatically shift down to the next line. This feature also works if you insert text into a line. The text following the inserted text will push past the right margin and wrap to the next line. 

Message Line

The Message Line is located below the File Content area. This line reports system messages to you and, when needed, is for keyboard input.

Command List

At the bottom of the screen is the Command List that displays a menu of commands from which to select. This is the main menu; through some commands, you will be able to access submenus.

Commands are invoked by what Pico considers to be special control-key sequences. A control-key sequence is when the control key, represented by a caret (^), is used in combination with a letter (e.g., ^G). So the Control+G key combination is indicated on the menu as ^G. Be sure to hold down the control key while you type G. Note that on some systems certain control-key sequences are diverted before reaching pico and you may be unable to use them. There is an optional way, however, to issue pico commands: you can press the Escape key twice (i.e., Esc Esc) followed by a letter. For example, instead of using ^C, you would use Esc Esc C.

Note: There is no case sensitivity in a pico control sequence: Control+G (^G) will work the same as Control+g (^g).

Getting Help

The ^G (Get Help) command gives you a list of pico commands. The help information in pico mentions using "F" function keys for certain commands. The help file refers to function keys; only the control key sequences will work in most terminal emulations.

Another feature of pico is its context-sensitive help. When you access the main menu and any submenus, you will find help for the feature you are accessing. For example, when you use the ^O (WriteOut) command, you will notice that the command list at the bottom of your screen will display the ^G (Help) command. Now when you press ^G, you will receive help on the ^O (WriteOut) command.

Moving Around Within the File

You can use the arrow keys on your keyboard to move the cursor in the usual way (right, left, up, down). There are also pico commands available that will enable you to move the cursor:

^F

move forward a character (same as right arrow)

^B

move backward a character (same as left arrow)

^P

move to the previous line (same as up arrow)

^N

move to the next line (same as down arrow)

^A

move to the beginning of the current line

^E

move to the end of the current line

^V

move forward a page of text

^Y

move backward a page of text

Note: If you are having problems with the cursor (arrow) keys, you should contact the Service Desk.

Searching for Text
When using the ^W (Where is) command, Pico allows you to search for a string of text. This search is not case-sensitive (i.e., searching for the characters service or SERVICE or Service will all result in finding the character string "service"). Also, Pico searches for the character string regardless of what is before or after the characters. So, if you initiate a search for service and you have the word services in your file, Pico will find any instance of services as well as service.

Your search will begin from your current position and continue to the end of the file. If Pico can't find the character string after it reaches the end of the file, the search wraps around to the top of the file, continuing until it finds the string or until it arrives back at the initial cursor position. This is referred as the Pico "search wrap" feature.

Note: Pico will only search for character strings. It does not have a search and replace or find and change feature.

Editing Text

^D (delete)

used to delete the character at the cursor position. The Backspace key or Delete key or Del key (depending on your keyboard) can be used to delete a character to the left of the cursor position.

^J (Justify)

used to justify (format) a paragraph. Pico considers a paragraph to be a body of text separated from another body of text by the use of a blank line. You should have a blank line between each paragraph. This is important because, when you complete a paragraph, you may find that some lines are much longer or shorter than others due to your having removed or added text. If you have separated your paragraphs with blank lines, you can position the cursor anywhere in the paragraph and type ^J (Control+J) to reformat the paragraph. The lines are adjusted so that they are approximately the same length within the 73-character margins.

 

Pico gives you the option to unjustify a paragraph by using ^U (UnJustify). This command is helpful when you are dissatisfied with the restulst of ^J. ^U (UnJusitfy) is only available for you to use immediately following ^J.

 

A line longer than the screen width may develop from joining lines, or inserting and/or deleting text within lines. Pico indicates the occurrence of a very long line of text by displaying a dollar sign ($) in the last position of the line. The text for a long line may disappear at the right edge of the screen but you can scroll through the line by using your arrow keys. It is not a good idea to maintain your file with long lines and it is suggested that you use the justify feature for text alignment.

^U (UnJustify)

Pico gives you the option to unjustify a paragraph by using ^U (UnJustify). This command is helpful when you are dissatisfied with the results of ^J. ^U (UnJustify) is only available for you to use immediately following ^J.

^T (To Spell)

used to check for spelling errors in the text of the file. When you use spell checking, it begins to alphabetically search for misspelled words. Pico will scan your text for words that aren't in its dictionary, and if it finds any, it will highlight the word and prompt you for a replacement word. If you don't want to change the word, just press Enter and the word will remain unchanged. To cancel spell checking at any time, use ^C (Cancel).

The Pico editor was designed for use with the pine mailer, which treats the ">" symbol as a special character. The ">" symbol is a signal Pico uses to indicate a line of text quoted from somewhere else. Therefore, when you run spell checking, it will not check for misspelled words on any line that begins with the ">" symbol.

Cutting, Pasting, and Copying Text

^^     Mark text 

^K     Cut text

^U     Uncut/paste

The Cut and Paste process allows you to remove (cut) a body of text and place (paste) it in a destination position. The Cut command will cut one line of text unless you designate a specific body of text to cut. To cut and paste one line of text, use the following steps:

1. Move your cursor to the line you wish to cut and type ^K (Cut). The line will disappear from your screen. This line has now been placed in a buffer (a temporary storage area).

2. Move your cursor to the destination position (where you would like to insert the text) and type ^U (Uncut/Paste) to paste your text.

The type of "cutting" described above is limited to whole lines. You, however, can cut more than one line. When you use ^K successively, you will continue to add these lines to the contents of the buffer until you use the ^U command (i.e., until you paste).

If you want to cut and paste a specific block of text, use the following steps:

1. Move your cursor to the position where you would like to begin your cut and type ^^ (Mark), i.e., Control+^. The message line at the bottom of the screen displays the message [Mark Set] indicating that you can now begin to specify the block of text that you want to cut. You can cancel this operation at any time before you do the cut by using the ^^ (Mark) command again. When you cancel, the status line will display the message [Mark Unset].

2. Move your cursor up, down, left, or right to highlight the block of text you wish to cut.

3. After you have highlighted your block of text, type ^K (Cut) to place the text in the Pico buffer.

4. Move your cursor to the destination position and type ^U (Uncut) to paste the text.

 Note: When using the Mark command, type Control Shift 6 or type Control ^ (depending on the communication program you are using). If neither works, type Esc Esc 6.

To copy text simply cut it as usual, using the ^K command, and then immediately do a paste (^U) to restore it. Then, move the cursor to the new destination and type ^U again to do a second paste. You can paste the same text as many times are you like until the next ^K command clears and replaces the buffer's contents or you exit from Pico.

Many Macintosh and Windows programs also allow their own copying and pasting (usually from the program's Edit menu). You can copy text from a word processor on your own computer, go to your program and use the Paste command from the Edit menu to paste the text into Pico. The text will be treated as if you had just typed it into your document. All lines (except those that end in a "hard" return in your word processor) will wrap nicely in Pico.

File Manipulation

^R   Read File

^O   Write Out

^R (Read File) is used to insert (read) a specific file from your UNIX account into your document at the current position. Lines selected using the ^R command remain exactly as they were in the original file from which they were read - there is no word wrapping.

A companion to this command is ^O (Write Out) which allows you to save your text to a given file name on your account without exiting from Pico. The ^O command also gives you the convenience of saving intermediate stages of your editing session.

The Pico File Browser

When you access ^R or ^O, your command line displays another submenu of commands. Included is ^T (To Files), which provides a route to a list of files, just in case you can't remember the name of the file you want to read in (^R) or you don't know if the file name already exists for the file you want to write out (^O).

^T (To Files) accesses the Pico file browser as illustrated below:

pico file browser

The file browser displays the files and directories available on your UNIX account. If you initiate the browser using the ^R command, it allows you to use the cursor keys to select a file to insert (or read into) your current edit session. This insertion is based on the position of your cursor within the file content area of your screen. If you initiate the browser using the ^O command, again, you can use the cursor to select a file. When you press Enter, however, you are asked if you want to overwrite the highlighted file with the file on which you were working in your file content area. Use caution when overwriting files.

The browser allows you to use other commands simply by entering a letter. You can rename (R) and search (W) for files and directories; copy (M) and delete (D) files; and go to (G) another directory and page through it.

Exit and Save a File
^X (Exit) from the main menu exits and saves your file. If you have entered any text during your editing session, Pico attempts to save the text that has been placed in a temporary buffer when you type ^X. If you indicate that you want to save the buffer contents, by typing y when prompted, Pico will then prompt you for a file name. If the file does not exist, Pico will create it. If the file exists, Pico will prompt you to confirm that you want to overwrite the file with the modified text. (To quit a file without saving changes, type n when prompted.)

The ^X (Exit) command can also be found on certain menus that you may enter (i.e., submenus); typing ^X (Exit) from within these submenus will return you to the main menu.

Miscellaneous Commands

^L (Layout Display) allows you to refresh your screen. From time to time, your screen may become distorted or garbled with unwanted characters. ^L allows you to "repaint" your screen for normal viewing.

^C (Cursor Position) from the main menu shows the line number for your current position. This information (displayed on the message line) indicates the total lines and characters within your file.