PICO Tutorial

This document is a local UB adaptation of the PICO tutorial developed at North Carolina State University. The original document can be found on the Web at http://www2.ncsu.edu/ncsu/cc/pub/tutorials/pico_tutor/pico.html, and is copyright 1997 by NCSU.


To get online help for PICO, press ctrl-g. The online help gives brief descriptions of the available commands.

Opening a Pico file

There are two ways to start using PICO.
  1. If you already have a file that you want to edit, or you know the name of a new file that you want to create, then to start using PICO, enter

    pico filename

    at the system prompt where filename is either the name of the file you want to edit (one that already exists) or the name you want to give to a new file you want to create.

  2. If you don't provide a filename (new or existing), Pico will open a new file, but it will be unnamed until you save it.

The screen for a new file will look something like this:

In the list of commands at the bottom of the PICO screen, the caret (^) stands for the control (ctrl) key. ^G means to hold down the control key and press G. PICO commands are always a combination of the control key and another key. Also, when you enter a PICO command you don't need to press the return key.


Trying it out: Create a new file with PICO

At your system prompt, enter pico. You should see a screen similar to the one shown earlier


Entering text in the file

The top line of your screen is called the status line. It shows what version of PICO you are using, the name of the file you are using (yours probably says something like New Buffer), and whether or not you have made changes (if you've entered anything into this blank file and haven't saved the changes, Modified will be in the upper right corner of the Pico screen). At the bottom of the screen are two lines showing the commands available for your use.

You can easily edit short files with only the following keys:

Now that you have an empty file, you can start typing. PICO automatically starts a new line when you run out of room (called "wrapping text," "text wrap," or "autowrap") so you don't need to watch the screen while you type.

Press [return] when you want to start a new line. If you want a blank line between lines of text or data, press [return] twice.


Trying it out: Entering text

Go ahead and enter the following text in the new file you created so you can get some practice typing in PICO and so you'll have something to edit later in this tutorial.

If you make any mistakes while typing, just use the backspace key to erase the mistake.

Mary had a little lamb, its fleece was white as snow, and everywhere that Mary went the lamb was sure to go.

It followed her to school one week
to see what it could find,
it then learned French so well
it blew little Mary's mind.


Saving the file

Now that you have a file that has something in it, it's a good time to save your work. You should save your files often, if for no other reason than strange things can, and sometimes do, happen. The common sense rule is to save often enough so that if you lose your work you won't have much to re-do. Most people recommend saving every 15 minutes.

To save a file, use ^o, which stands for writeOut because you're writing what you've done to a file as output. When you press ^o, Pico will prompt you for the filename. If the file doesn't have a name yet, you'll need to type one in. If the file does have a name, it will follow the file name prompt, and all you need to do is press [return].


Trying it out: Saving the file

  1. Press ^o .
  2. When prompted for the filename, type mary_lamb.txt and then press [return].
  3. On the line just above the list of commands, Pico will tell you how many lines it saved. In this example, you'll probably see [ Wrote 7 lines ]


Finding characters and words

If you're proofreading your file by looking at a printout of it, it can tricky to find the specific line you want to revise. An easy way to get to the right point in your file is to use PICO's search, or Whereis, command, which is ^w. This command lets you enter a character(s) or word(s) to search for, and then moves the cursor to the first occurrence. PICO begins the search from the point in the file where the cursor is located. So, if the cursor is at the beginning of the second paragraph, the search begins at the beginning of the second paragraph.

To find a specific character or word, press ctrl-w (for where is). A black strip with Search: will replace the two lines of commands at the bottom of the screen. You should then type the character(s) or word(s) you want to find. This search command is not case sensitive -- if you type Lamb at the search prompt, the system would find lamb. This search command is also not limited to finding only whole words. For example, if you were to tell PICO to find th, it would find that, the, they, and the.

Deleting characters and lines and bringing them back again

Cutting, or deleting, text is usually a major component of any kind of editing. PICO gives you two ways to cut text: you can cut it a character at a time or a line at a time. (Unfortunately, you can't cut it a word at a time.)

To delete a character, place the cursor on the character you want to delete and press ctrl-d. Pressing your keyboard's delete key (some keyboards label it backspace) will delete the character preceding the cursor.

To delete an entire line, place the cursor anywhere within the line and press ctrl-k (for kill or cut text). The entire line will then be cut. If you change your mind about deleting the line before you delete another one, you can press ctrl-u to bring back the line. The restored line will be placed wherever the cursor is (even in the middle of another line).

Since ctrl-u lets you restore the cut line wherever the cursor is and not just to wherever it came from, you can use ctrl-k and ctrl-u to "cut and paste" text. In PICO you move blocks of text pretty much as you would if you were using a microcomputer word processing package. You first need to mark (highlight) the text you want to move. Then you cut the text, move the cursor to where you want the text inserted, then paste it.

1. Position your cursor at the beginning of the first line of the text block you want to move.

2. Press ctrl-^ (ctrl-shift-6 keys).

3. Move the cursor to the end of the block you want to cut. The text should then be highlighted.

4. Once the block is highlighted, press ctrl-k to cut the text.

5. Place the cursor to where you want the text placed, and press ctrl-u. The text should then appear.

Filling paragraphs

To justify a paragraph (fill in gaps left by starting a new line) enter ctrl-j. PICO defines paragraphs as text surrounded by blank lines or indentation. For example, suppose you had the following lines in your text file:

It followed her to school one week
to see what it could find,
it then learned French so well
It blew little Mary's mind.

If you were to place the cursor within the first three lines and press ctrl-j, the text would then look like the following:

It followed her to school one week to see what it could find, it then learned French so well

It blew little Mary's mind.

However, if you had a blank line between each line of text pressing ctrl-j would not affect the text.

If you don't like the result of the justified text, before you move the cursor outside the paragraph press ctrl-u to "unjustify" the paragraph. Once you've justified text, the ctrl-u command's function changes from undelete to unjustify. However, when you move the cursor from the justified paragraph, the ctrl-u command function returns to undelete. Therefore, if you need to unjustify the paragraph, you must do so before you move the cursor outside the paragraph.

To join lines that are separated by blank lines (in the example above to move our "it blew little Mary's mind" so it was immediately below "it then learned French so well") use ctrl-k to delete the blank line and then use ctrl-j to fill the paragraph.


Trying it out: find, delete, undelete, and justify

Here you can practice editing the text you entered in to mary_lamb.txt. Your file probably looks something like this:

Mary had a little lamb, its fleece was white as snow, and everywhere that Mary went the lamb was sure to go.

It followed her to school one week
to see what it could find,
it then learned French so well
it blew little Mary's mind.

Change "Mary" to "Fidel"

  1. Press ctrl-w to get the search prompt.

  2. At the prompt, type Mary and press [return].

    The cursor should move to the first "Mary".

  3. Move the cursor to the blank space after Mary and backspace over the word to delete it.

  4. Type "Fidel".

  5. Repeat the process to replace the other Marys.

Move the last line ("it blew little Mary's mind") to the third line

  1. Place the cursor on the last line.

  2. Press ctrl-k. The line will disappear.

  3. Move the cursor to the beginning of the third line.

  4. Press ctrl-u. The line, "it blew little Mary's mind", should appear at the insertion point.

Now make the three last lines one continuous line

  1. Place the cursor anywhere within the three lines.

  2. Press ctrl-j. The three lines should merge to one "paragraph".

    Fidel had a little lamb, its fleece was white as snow, and everywhere that Fidel went the lamb was sure to go.
    it blew little Fidel's mind.

    It followed her to school one day to see what it could find, it then learned French so well

  3. Press ctrl-u to "unmerge" the last paragraph.

  • Repeat steps 1-2 to remerge it.


    Spellchecker

    PICO offers a spellchecker that will check the spelling in your text files. To start the spellchecker press ctrl-t. The PICO spellchecker compares the words in your file to words that are in its dictionary. When it finds a word that isn't in its dictionary, it sends the prompt Edit a replacement: followed by the misspelled word. If the word is correct, just press return. If the word is misspelled, you can change it by backspacing over it (to delete it) and then typing the correct word. You can also use the cursor and delete keys to edit parts of the word.


    Trying it out: Spell Checking

    Run the spellchecker on your file. It should identify ``Fidel'' as being misspelled. Of course, it isn't, but ``Fidel'' is not in PICO's spelling dictionary, so it thinks that it's misspelled. Let's make believe that it is a misspelled word, and that you want to correct it to be your own name. So: Using the spellchecker, change all occurrences of ``Fidel'' to be your own name.

    Copying an existing file into your PICO file

    To insert a file into the one you are currently editing, place the cursor where you want to place the inserted file. Then press ctrl-r. After you press ctrl-r you'll receive the prompt Insert file: Enter the name of the file you want to insert and press return. The inserted file's contents will be inserted at the cursor. This command does not delete or in any way alter the file that is to be inserted (a copy of the file is inserted).

    If you change your mind about inserting the file after you've pressed ctrl-r, when prompted for the filename enter any character string that doesn't correspond with a file. The system will attempt to process the command, but when it doesn't find a corresponding file it will cancel the command and your text will not be altered. You will, however, receive the message No such file: followed by the character string you entered.


    Trying it out: Inserting a file into PICO

    Move your cursor to the line just below the last line of your text. Insert the file: .cshrc

    Ending a PICO session

    Press ctrl-x to quit (or exit) PICO. The system will prompt you with a message asking if you want to save your changes. Y saves the changes and N quits PICO without saving what you've done since the last time you saved.

    Other good things to know about PICO

    Timeout

    If you dial in to your account but don't do anything (such as press a key) for some time, there's a good chance you will be disconnected. This won't happen, however, if you're using Pico; it will only happen if you're at the system prompt.

    Ctrl-keys for moving around in a file

    If for some reason you can't use cursor (arrow) keys, you can use the following commands to move around in your file.

      ctrl-p  move to the Previous line. 
    
      ctrl-n  move to the Next line. 
    
      ctrl-f  move Forward a character.
     
      ctrl-b  move Backward a character. 

    Clearing the display

    If your display becomes cluttered (most likely because of interactive messages), you can clear or refresh it by entering ctrl-l. The messages are erased from your screen and the file you are working with remains.




    William J. Rapaport (rapaport@cse.buffalo.edu)
    file: UB.pico.tutorial.26ag99.html